sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def listDataTiers(self, data_tier_name=""):
"""
List data tier(s)
"""
if not isinstance(data_tier_name, basestring) :
dbsExceptionHandler('dbsException-invalid-input',
'data_tier_name given is not valid : %s' % data_tier_name)
else:
... | List data tier(s) | entailment |
def execute(self, conn, site_name= "", transaction = False):
"""
Lists all sites types if site_name is not provided.
"""
sql = self.sql
if site_name == "":
result = self.dbi.processData(sql, conn=conn, transaction=transaction)
else:
sql += "WHERE S... | Lists all sites types if site_name is not provided. | entailment |
def execute(self, conn, logical_file_name={}, transaction=False):
"""
simple execute
"""
if not conn:
dbsExceptionHandler("dbsException-db-conn-failed", "Oracle/FileBuffer/DeleteFiles. Expects db connection from upper layer.")
self.dbi.processData(self.sql, logical_file_name, conn... | simple execute | entailment |
def listDataType(self, dataType="", dataset=""):
"""
List data-type/primary-ds-type
"""
conn = self.dbi.connection()
try:
if dataset and dataType:
dbsExceptionHandler('dbsException-invalid-input',
"DBSDataType/listDataType. Data Ty... | List data-type/primary-ds-type | entailment |
def getBlocks(self):
"""
Get the blocks that need to be migrated
"""
try:
conn = self.dbi.connection()
result = self.buflistblks.execute(conn)
return result
finally:
if conn:
conn.close() | Get the blocks that need to be migrated | entailment |
def getBufferedFiles(self, block_id):
"""
Get some files from the insert buffer
"""
try:
conn = self.dbi.connection()
result = self.buflist.execute(conn, block_id)
return result
finally:
if conn:
conn.cl... | Get some files from the insert buffer | entailment |
def execute(self, conn, data_tier_name='', transaction = False, cache=None):
"""
returns id for a given datatier name
"""
if cache:
ret=cache.get("DATA_TIERS")
if not ret==None:
return ret
sql = self.sql
binds={}
if data_tier_name:
o... | returns id for a given datatier name | entailment |
def execute(self, conn, migration_url="", migration_input="", create_by="", migration_request_id="", transaction=False):
"""
Lists the oldest request queued
"""
binds = {}
result = self.dbi.processData(self.sql, binds, conn, transaction)
result = self.formatDict(result)
if len... | Lists the oldest request queued | entailment |
def listProcessingEras(self, processing_version=''):
"""
Returns all processing eras in dbs
"""
conn = self.dbi.connection()
try:
result = self.pelst.execute(conn, processing_version)
return result
finally:
if conn:
conn... | Returns all processing eras in dbs | entailment |
def insertProcessingEra(self, businput):
"""
Input dictionary has to have the following keys:
processing_version, creation_date, create_by, description
it builds the correct dictionary for dao input and executes the dao
"""
conn = self.dbi.connection()
tran = con... | Input dictionary has to have the following keys:
processing_version, creation_date, create_by, description
it builds the correct dictionary for dao input and executes the dao | entailment |
def listPhysicsGroups(self, physics_group_name=""):
"""
Returns all physics groups if physics group names are not passed.
"""
if not isinstance(physics_group_name, basestring):
dbsExceptionHandler('dbsException-invalid-input',
'physics group name given is not ... | Returns all physics groups if physics group names are not passed. | entailment |
def create_token_generator(input_list):
"""SQL Generator to select from list of values in Oracle"""
###Generator trick from http://betteratoracle.com/posts/20-how-do-i-bind-a-variable-in-list
###The maximum length of the comma separated list is 4000 characters, therefore we need to split the list
###ORA... | SQL Generator to select from list of values in Oracle | entailment |
def getServices(self):
"""
Simple method that returs list of all know DBS instances, instances known to this registry
"""
try:
conn = self.dbi.connection()
result = self.serviceslist.execute(conn)
return result
except Exception as ex:
... | Simple method that returs list of all know DBS instances, instances known to this registry | entailment |
def addService(self):
"""
Add a service to service registry
"""
conn = self.dbi.connection()
tran = conn.begin()
try:
body = request.body.read()
service = cjson.decode(body)
addthis = {}
addthis['service_id'] =... | Add a service to service registry | entailment |
def execute(self, conn, daoinput, transaction = False):
"""
required keys:
migration_status, migration_request_id
"""
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationRequests/UpdateRequestStatus. Expects db connection from upper layer.",
... | required keys:
migration_status, migration_request_id | entailment |
def execute(self, conn, migration_url="", migration_input="", create_by="", migration_request_id="", oldest= False, transaction=False):
"""
Lists all requests if pattern is not provided.
"""
sql = self.sql
binds = {}
if migration_request_id:
sql += " WHERE MR.MIGRATION_REQU... | Lists all requests if pattern is not provided. | entailment |
def execute(self, conn, logical_file_name, transaction=False):
"""
simple execute
"""
if not conn:
dbsExceptionHandler("dbsException-db-conn-failed", "Oracle/FileBuffer/DeleteDupicates. Expects db connection from upper layer.")
print(self.sql)
self.dbi.processData(self.sql, logical_fil... | simple execute | entailment |
def execute(self, conn, block_name="", transaction = False):
"""
block: /a/b/c#d
"""
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/BlockParent/List. Expects db connection from upper layer.", self.logger.exception)
sql = self.sql
if i... | block: /a/b/c#d | entailment |
def execute(self, conn, origin_site_name="", dataset="", block_name="", transaction = False):
"""
origin_site_name: T1_US_FNAL_Buffer
dataset: /a/b/c
block_name: /a/b/c#d
"""
if not conn:
dbsExceptionHandler("dbsException-db-conn-failed",
... | origin_site_name: T1_US_FNAL_Buffer
dataset: /a/b/c
block_name: /a/b/c#d | entailment |
def listPrimaryDatasets(self, primary_ds_name="", primary_ds_type=""):
"""
Returns all primary dataset if primary_ds_name or primary_ds_type are not passed.
"""
conn = self.dbi.connection()
try:
result = self.primdslist.execute(conn, primary_ds_name, primary_ds_type)
... | Returns all primary dataset if primary_ds_name or primary_ds_type are not passed. | entailment |
def listPrimaryDSTypes(self, primary_ds_type="", dataset=""):
"""
Returns all primary dataset types if dataset or primary_ds_type are not passed.
"""
conn = self.dbi.connection()
try:
result = self.primdstypeList.execute(conn, primary_ds_type, dataset)
if ... | Returns all primary dataset types if dataset or primary_ds_type are not passed. | entailment |
def insertPrimaryDataset(self, businput):
"""
Input dictionary has to have the following keys:
primary_ds_name, primary_ds_type, creation_date, create_by.
it builds the correct dictionary for dao input and executes the dao
"""
conn = self.dbi.connection()
tran = c... | Input dictionary has to have the following keys:
primary_ds_name, primary_ds_type, creation_date, create_by.
it builds the correct dictionary for dao input and executes the dao | entailment |
def execute(self, conn, name='', transaction = False):
"""
returns id for a given physics group name
"""
binds={}
if name:
op = ('=', 'like')['%' in name]
sql = self.sql + " WHERE pg.physics_group_name %s :physicsgroup" % (op)
binds = {"physic... | returns id for a given physics group name | entailment |
def insertOutputConfig(self, businput):
"""
Method to insert the Output Config.
app_name, release_version, pset_hash, global_tag and output_module_label are
required.
args:
businput(dic): input dictionary.
Updated Oct 12, 2011
"""
if not ... | Method to insert the Output Config.
app_name, release_version, pset_hash, global_tag and output_module_label are
required.
args:
businput(dic): input dictionary.
Updated Oct 12, 2011 | entailment |
def getHelp(self, call=""):
"""
API to get a list of supported REST APIs. In the case a particular API is specified,
the docstring of that API is displayed.
:param call: call to get detailed information about (Optional)
:type call: str
:return: List of APIs or detailed i... | API to get a list of supported REST APIs. In the case a particular API is specified,
the docstring of that API is displayed.
:param call: call to get detailed information about (Optional)
:type call: str
:return: List of APIs or detailed information about a specific call (parameters and... | entailment |
def listPrimaryDatasets(self, primary_ds_name="", primary_ds_type=""):
"""
API to list primary datasets
:param primary_ds_type: List primary datasets with primary dataset type (Optional)
:type primary_ds_type: str
:param primary_ds_name: List that primary dataset (Optional)
... | API to list primary datasets
:param primary_ds_type: List primary datasets with primary dataset type (Optional)
:type primary_ds_type: str
:param primary_ds_name: List that primary dataset (Optional)
:type primary_ds_name: str
:returns: List of dictionaries containing the follow... | entailment |
def listPrimaryDsTypes(self, primary_ds_type="", dataset=""):
"""
API to list primary dataset types
:param primary_ds_type: List that primary dataset type (Optional)
:type primary_ds_type: str
:param dataset: List the primary dataset type for that dataset (Optional)
:typ... | API to list primary dataset types
:param primary_ds_type: List that primary dataset type (Optional)
:type primary_ds_type: str
:param dataset: List the primary dataset type for that dataset (Optional)
:type dataset: str
:returns: List of dictionaries containing the following key... | entailment |
def listDatasets(self, dataset="", parent_dataset="", is_dataset_valid=1,
release_version="", pset_hash="", app_name="", output_module_label="", global_tag="",
processing_version=0, acquisition_era_name="", run_num=-1,
physics_group_name="", logical_file_name="", primary_ds_name="", primary_ds_t... | API to list dataset(s) in DBS
* You can use ANY combination of these parameters in this API
* In absence of parameters, all valid datasets known to the DBS instance will be returned
:param dataset: Full dataset (path) of the dataset.
:type dataset: str
:param parent_dataset: Fu... | entailment |
def listDatasetArray(self):
"""
API to list datasets in DBS. To be called by datasetlist url with post call.
:param dataset: list of datasets [dataset1,dataset2,..,dataset n] (must have either a list of dataset or dataset_id), Max length 1000.
:type dataset: list
:param dataset_id: lis... | API to list datasets in DBS. To be called by datasetlist url with post call.
:param dataset: list of datasets [dataset1,dataset2,..,dataset n] (must have either a list of dataset or dataset_id), Max length 1000.
:type dataset: list
:param dataset_id: list of dataset ids [dataset_id1,dataset_id2,..,dat... | entailment |
def listDataTiers(self, data_tier_name=""):
"""
API to list data tiers known to DBS.
:param data_tier_name: List details on that data tier (Optional)
:type data_tier_name: str
:returns: List of dictionaries containing the following keys (data_tier_id, data_tier_name, create_by, ... | API to list data tiers known to DBS.
:param data_tier_name: List details on that data tier (Optional)
:type data_tier_name: str
:returns: List of dictionaries containing the following keys (data_tier_id, data_tier_name, create_by, creation_date) | entailment |
def listBlocks(self, dataset="", block_name="", data_tier_name="", origin_site_name="",
logical_file_name="",run_num=-1, min_cdate='0', max_cdate='0',
min_ldate='0', max_ldate='0', cdate='0', ldate='0', open_for_writing=-1, detail=False):
"""
API to list a block i... | API to list a block in DBS. At least one of the parameters block_name, dataset, data_tier_name or
logical_file_name are required. If data_tier_name is provided, min_cdate and max_cdate have to be specified and
the difference in time have to be less than 31 days.
:param block_name: name of the b... | entailment |
def listBlockOrigin(self, origin_site_name="", dataset="", block_name=""):
"""
API to list blocks first generated in origin_site_name.
:param origin_site_name: Origin Site Name (Optional, No wildcards)
:type origin_site_name: str
:param dataset: dataset ( No wildcards, either d... | API to list blocks first generated in origin_site_name.
:param origin_site_name: Origin Site Name (Optional, No wildcards)
:type origin_site_name: str
:param dataset: dataset ( No wildcards, either dataset or block name needed)
:type dataset: str
:param block_name:
:type... | entailment |
def listBlocksParents(self):
"""
API to list block parents of multiple blocks. To be called by blockparents url with post call.
:param block_names: list of block names [block_name1, block_name2, ...] (Required). Mwx length 1000.
:type block_names: list
"""
try :
... | API to list block parents of multiple blocks. To be called by blockparents url with post call.
:param block_names: list of block names [block_name1, block_name2, ...] (Required). Mwx length 1000.
:type block_names: list | entailment |
def listBlockChildren(self, block_name=""):
"""
API to list block children.
:param block_name: name of block who's children needs to be found (Required)
:type block_name: str
:returns: List of dictionaries containing following keys (block_name)
:rtype: list of dicts
... | API to list block children.
:param block_name: name of block who's children needs to be found (Required)
:type block_name: str
:returns: List of dictionaries containing following keys (block_name)
:rtype: list of dicts | entailment |
def listBlockSummaries(self, block_name="", dataset="", detail=False):
"""
API that returns summary information like total size and total number of events in a dataset or a list of blocks
:param block_name: list block summaries for block_name(s)
:type block_name: str, list
:para... | API that returns summary information like total size and total number of events in a dataset or a list of blocks
:param block_name: list block summaries for block_name(s)
:type block_name: str, list
:param dataset: list block summaries for all blocks in dataset
:type dataset: str
... | entailment |
def listFiles(self, dataset = "", block_name = "", logical_file_name = "",
release_version="", pset_hash="", app_name="", output_module_label="",
run_num=-1, origin_site_name="", lumi_list="", detail=False, validFileOnly=0, sumOverLumi=0):
"""
API to list files in DBS. Either non-wildcar... | API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset or non-wildcarded block_name is required.
The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported.
* For lumi_list the following two json formats are supported:
... | entailment |
def listFileArray(self):
"""
API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset,
non-wildcarded block_name or non-wildcarded lfn list is required.
The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported.... | API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset,
non-wildcarded block_name or non-wildcarded lfn list is required.
The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported.
* For lumi_list the followi... | entailment |
def listFileSummaries(self, block_name='', dataset='', run_num=-1, validFileOnly=0, sumOverLumi=0):
"""
API to list number of files, event counts and number of lumis in a given block or dataset.
If the optional run_num, output are:
* The number of files which have data (lumis) ... | API to list number of files, event counts and number of lumis in a given block or dataset.
If the optional run_num, output are:
* The number of files which have data (lumis) for that run number;
* The total number of events in those files;
* The total number of ... | entailment |
def listDatasetParents(self, dataset=''):
"""
API to list A datasets parents in DBS.
:param dataset: dataset (Required)
:type dataset: str
:returns: List of dictionaries containing the following keys (this_dataset, parent_dataset_id, parent_dataset)
:rtype: list of dicts... | API to list A datasets parents in DBS.
:param dataset: dataset (Required)
:type dataset: str
:returns: List of dictionaries containing the following keys (this_dataset, parent_dataset_id, parent_dataset)
:rtype: list of dicts | entailment |
def listOutputConfigs(self, dataset="", logical_file_name="",
release_version="", pset_hash="", app_name="",
output_module_label="", block_id=0, global_tag=''):
"""
API to list OutputConfigs in DBS.
* You can use any combination of these param... | API to list OutputConfigs in DBS.
* You can use any combination of these parameters in this API
* All parameters are optional, if you do not provide any parameter, all configs will be listed from DBS
:param dataset: Full dataset (path) of the dataset
:type dataset: str
:param l... | entailment |
def listFileParents(self, logical_file_name='', block_id=0, block_name=''):
"""
API to list file parents
:param logical_file_name: logical_file_name of file (Required)
:type logical_file_name: str, list
:param block_id: ID of the a block, whose files should be listed
:ty... | API to list file parents
:param logical_file_name: logical_file_name of file (Required)
:type logical_file_name: str, list
:param block_id: ID of the a block, whose files should be listed
:type block_id: int, str
:param block_name: Name of the block, whose files should be listed... | entailment |
def listFileParentsByLumi(self):
"""
IMPORTANT: This is ***WMAgent*** sepcial case API. It is not for others.
API to list File Parentage for a given block with or w/o a list of LFN. It is used with the POST method of fileparents call.
Using the child_lfn_list will significantly affect ... | IMPORTANT: This is ***WMAgent*** sepcial case API. It is not for others.
API to list File Parentage for a given block with or w/o a list of LFN. It is used with the POST method of fileparents call.
Using the child_lfn_list will significantly affect the API running speed.
:param block... | entailment |
def listFileChildren(self, logical_file_name='', block_name='', block_id=0):
"""
API to list file children. One of the parameters in mandatory.
:param logical_file_name: logical_file_name of file (Required)
:type logical_file_name: str, list
:param block_name: block_name
... | API to list file children. One of the parameters in mandatory.
:param logical_file_name: logical_file_name of file (Required)
:type logical_file_name: str, list
:param block_name: block_name
:type block_name: str
:param block_id: block_id
:type block_id: str, int
... | entailment |
def listFileLumis(self, logical_file_name="", block_name="", run_num=-1, validFileOnly=0):
"""
API to list Lumi for files. Either logical_file_name or block_name is required. No wild card support in this API
:param block_name: Name of the block
:type block_name: str
:param logic... | API to list Lumi for files. Either logical_file_name or block_name is required. No wild card support in this API
:param block_name: Name of the block
:type block_name: str
:param logical_file_name: logical_file_name of file
:type logical_file_name: str, list
:param run_num: List... | entailment |
def listRuns(self, run_num=-1, logical_file_name="", block_name="", dataset=""):
"""
API to list all runs in DBS. At least one parameter is mandatory.
:param logical_file_name: List all runs in the file
:type logical_file_name: str
:param block_name: List all runs in the block
... | API to list all runs in DBS. At least one parameter is mandatory.
:param logical_file_name: List all runs in the file
:type logical_file_name: str
:param block_name: List all runs in the block
:type block_name: str
:param dataset: List all runs in that dataset
:type data... | entailment |
def listDataTypes(self, datatype="", dataset=""):
"""
API to list data types known to dbs (when no parameter supplied).
:param dataset: Returns data type (of primary dataset) of the dataset (Optional)
:type dataset: str
:param datatype: List specific data type
:type data... | API to list data types known to dbs (when no parameter supplied).
:param dataset: Returns data type (of primary dataset) of the dataset (Optional)
:type dataset: str
:param datatype: List specific data type
:type datatype: str
:returns: List of dictionaries containing the follow... | entailment |
def dumpBlock(self, block_name):
"""
API the list all information related with the block_name
:param block_name: Name of block to be dumped (Required)
:type block_name: str
"""
try:
return self.dbsBlock.dumpBlock(block_name)
except HTTPError as he:
... | API the list all information related with the block_name
:param block_name: Name of block to be dumped (Required)
:type block_name: str | entailment |
def listAcquisitionEras(self, acquisition_era_name=''):
"""
API to list all Acquisition Eras in DBS.
:param acquisition_era_name: Acquisition era name (Optional, wild cards allowed)
:type acquisition_era_name: str
:returns: List of dictionaries containing following keys (descrip... | API to list all Acquisition Eras in DBS.
:param acquisition_era_name: Acquisition era name (Optional, wild cards allowed)
:type acquisition_era_name: str
:returns: List of dictionaries containing following keys (description, end_date, acquisition_era_name, create_by, creation_date and start_dat... | entailment |
def listProcessingEras(self, processing_version=0):
"""
API to list all Processing Eras in DBS.
:param processing_version: Processing Version (Optional). If provided just this processing_version will be listed
:type processing_version: str
:returns: List of dictionaries containi... | API to list all Processing Eras in DBS.
:param processing_version: Processing Version (Optional). If provided just this processing_version will be listed
:type processing_version: str
:returns: List of dictionaries containing the following keys (create_by, processing_version, description, creat... | entailment |
def listReleaseVersions(self, release_version='', dataset='', logical_file_name=''):
"""
API to list all release versions in DBS
:param release_version: List only that release version
:type release_version: str
:param dataset: List release version of the specified dataset
... | API to list all release versions in DBS
:param release_version: List only that release version
:type release_version: str
:param dataset: List release version of the specified dataset
:type dataset: str
:param logical_file_name: List release version of the logical file name
... | entailment |
def listDatasetAccessTypes(self, dataset_access_type=''):
"""
API to list dataset access types.
:param dataset_access_type: List that dataset access type (Optional)
:type dataset_access_type: str
:returns: List of dictionary containing the following key (dataset_access_type).
... | API to list dataset access types.
:param dataset_access_type: List that dataset access type (Optional)
:type dataset_access_type: str
:returns: List of dictionary containing the following key (dataset_access_type).
:rtype: List of dicts | entailment |
def listPhysicsGroups(self, physics_group_name=''):
"""
API to list all physics groups.
:param physics_group_name: List that specific physics group (Optional)
:type physics_group_name: basestring
:returns: List of dictionaries containing the following key (physics_group_name)
... | API to list all physics groups.
:param physics_group_name: List that specific physics group (Optional)
:type physics_group_name: basestring
:returns: List of dictionaries containing the following key (physics_group_name)
:rtype: list of dicts | entailment |
def listRunSummaries(self, dataset="", run_num=-1):
"""
API to list run summaries, like the maximal lumisection in a run.
:param dataset: dataset name (Optional)
:type dataset: str
:param run_num: Run number (Required)
:type run_num: str, long, int
:rtype: list c... | API to list run summaries, like the maximal lumisection in a run.
:param dataset: dataset name (Optional)
:type dataset: str
:param run_num: Run number (Required)
:type run_num: str, long, int
:rtype: list containing a dictionary with key max_lumi | entailment |
def list():
""" List all events """
entries = lambder.list_events()
for e in entries:
click.echo(str(e)) | List all events | entailment |
def add(name, function_name, cron):
""" Create an event """
lambder.add_event(name=name, function_name=function_name, cron=cron) | Create an event | entailment |
def load(file):
""" Load events from a json file """
with open(file, 'r') as f:
contents = f.read()
lambder.load_events(contents) | Load events from a json file | entailment |
def functions(context):
""" Manage AWS Lambda functions """
# find lambder.json in CWD
config_file = "./lambder.json"
if os.path.isfile(config_file):
context.obj = FunctionConfig(config_file)
pass | Manage AWS Lambda functions | entailment |
def list():
""" List lambder functions """
functions = lambder.list_functions()
output = json.dumps(
functions,
sort_keys=True,
indent=4,
separators=(',', ':')
)
click.echo(output) | List lambder functions | entailment |
def new(
name,
bucket,
timeout,
memory,
description,
subnet_ids,
security_group_ids
):
""" Create a new lambda project """
config = {}
if timeout:
config['timeout'] = timeout
if memory:
config['memory'] = memory
if description:
config['description'... | Create a new lambda project | entailment |
def deploy(
config,
name,
bucket,
timeout,
memory,
description,
subnet_ids,
security_group_ids
):
""" Deploy/Update a function from a project directory """
# options should override config if it is there
myname = name or config.name
mybucket = bucket or config.bucket
... | Deploy/Update a function from a project directory | entailment |
def rm(config, name, bucket):
""" Delete lambda function, role, and zipfile """
# options should override config if it is there
myname = name or config.name
mybucket = bucket or config.bucket
click.echo('Deleting {} from {}'.format(myname, mybucket))
lambder.delete_function(myname, mybucket) | Delete lambda function, role, and zipfile | entailment |
def invoke(config, name, input):
""" Invoke function in AWS """
# options should override config if it is there
myname = name or config.name
click.echo('Invoking ' + myname)
output = lambder.invoke_function(myname, input)
click.echo(output) | Invoke function in AWS | entailment |
def putBlock(self, blockcontent, migration=False):
"""
Insert the data in sereral steps and commit when each step finishes or rollback if there is a problem.
"""
#YG
try:
#1 insert configuration
self.logger.debug("insert configuration")
configL... | Insert the data in sereral steps and commit when each step finishes or rollback if there is a problem. | entailment |
def insertOutputModuleConfig(self, remoteConfig, migration=False):
"""
Insert Release version, application, parameter set hashes and the map(output module config).
"""
otptIdList = []
missingList = []
conn = self.dbi.connection()
try:
for c in remoteC... | Insert Release version, application, parameter set hashes and the map(output module config). | entailment |
def insertDataset(self, blockcontent, otptIdList, migration=False):
"""
This method insert a datsset from a block object into dbs.
"""
dataset = blockcontent['dataset']
conn = self.dbi.connection()
# First, check and see if the dataset exists.
try:
da... | This method insert a datsset from a block object into dbs. | entailment |
def insertDatasetWOannex(self, dataset, blockcontent, otptIdList, conn,
insertDataset = True, migration = False):
"""
_insertDatasetOnly_
Insert the dataset and only the dataset
Meant to be called after everything else is put into place.
The insertD... | _insertDatasetOnly_
Insert the dataset and only the dataset
Meant to be called after everything else is put into place.
The insertDataset flag is set to false if the dataset already exists | entailment |
def listSites(self, block_name="", site_name=""):
"""
Returns sites.
"""
try:
conn = self.dbi.connection()
if block_name:
result = self.blksitelist.execute(conn, block_name)
else:
result = self.sitelist.execute(conn, sit... | Returns sites. | entailment |
def insertSite(self, businput):
"""
Input dictionary has to have the following keys:
site_name
it builds the correct dictionary for dao input and executes the dao
"""
conn = self.dbi.connection()
tran = conn.begin()
try:
siteobj = { # FIXME: un... | Input dictionary has to have the following keys:
site_name
it builds the correct dictionary for dao input and executes the dao | entailment |
def _create_das_mapping(self):
"""
das_map = {'lookup' : [{params : {'param1' : 'required', 'param2' : 'optional', 'param3' : 'default_value' ...},
url : 'https://cmsweb.cern.ch:8443/dbs/prod/global/DBSReader/acquisitioneras/',
das_map : {'... | das_map = {'lookup' : [{params : {'param1' : 'required', 'param2' : 'optional', 'param3' : 'default_value' ...},
url : 'https://cmsweb.cern.ch:8443/dbs/prod/global/DBSReader/acquisitioneras/',
das_map : {'das_param1' : dbs_param1, ...}
... | entailment |
def slicedIterator(sourceList, sliceSize):
"""
:param: sourceList: list which need to be sliced
:type: list
:param: sliceSize: size of the slice
:type: int
:return: iterator of the sliced list
"""
start = 0
end = 0
while len(sourceList) > end:
end = start + sliceSize
... | :param: sourceList: list which need to be sliced
:type: list
:param: sliceSize: size of the slice
:type: int
:return: iterator of the sliced list | entailment |
def checkInputParameter(method, parameters, validParameters, requiredParameters=None):
"""
Helper function to check input by using before sending to the server
:param method: Name of the API
:type method: str
:param validParameters: Allow parameters for the API call
:type validParameters: list
... | Helper function to check input by using before sending to the server
:param method: Name of the API
:type method: str
:param validParameters: Allow parameters for the API call
:type validParameters: list
:param requiredParameters: Required parameters for the API call (Default: None)
:type requi... | entailment |
def list_parameter_splitting(data, key, size_limit=8000, method='GET'):
"""
Helper function split list used as input parameter for requests,
since Apache has a limitation to 8190 Bytes for the lenght of an URI.
We extended it to also split lfn and dataset list length for POST calls to avoid
DB abuse... | Helper function split list used as input parameter for requests,
since Apache has a limitation to 8190 Bytes for the lenght of an URI.
We extended it to also split lfn and dataset list length for POST calls to avoid
DB abuse even if there is no limit on hoe long the list can be. YG 2015-5-13
:param data... | entailment |
def split_calls(func):
"""
Decorator to split up server calls for methods using url parameters, due to the lenght
limitation of the URI in Apache. By default 8190 bytes
"""
def wrapper(*args, **kwargs):
#The size limit is 8190 bytes minus url and api to call
#For example (https://cms... | Decorator to split up server calls for methods using url parameters, due to the lenght
limitation of the URI in Apache. By default 8190 bytes | entailment |
def __callServer(self, method="", params={}, data={}, callmethod='GET', content='application/json'):
"""
A private method to make HTTP call to the DBS Server
:param method: REST API to call, e.g. 'datasets, blocks, files, ...'.
:type method: str
:param params: Parameters to the ... | A private method to make HTTP call to the DBS Server
:param method: REST API to call, e.g. 'datasets, blocks, files, ...'.
:type method: str
:param params: Parameters to the API call, e.g. {'dataset':'/PrimaryDS/ProcessedDS/TIER'}.
:type params: dict
:param callmethod: The HTTP ... | entailment |
def __parseForException(self, http_error):
"""
An internal method, should not be used by clients
:param httperror: Thrown httperror by the server
"""
data = http_error.body
try:
if isinstance(data, str):
data = cjson.decode(data)
excep... | An internal method, should not be used by clients
:param httperror: Thrown httperror by the server | entailment |
def requestTimingInfo(self):
"""
Returns the time needed to process the request by the frontend server in microseconds
and the EPOC timestamp of the request in microseconds.
:rtype: tuple containing processing time and timestamp
"""
try:
return tuple(item.spl... | Returns the time needed to process the request by the frontend server in microseconds
and the EPOC timestamp of the request in microseconds.
:rtype: tuple containing processing time and timestamp | entailment |
def insertBulkBlock(self, blockDump):
"""
API to insert a bulk block
:param blockDump: Output of the block dump command, example can be found in https://svnweb.cern.ch/trac/CMSDMWM/browser/DBS/trunk/Client/tests/dbsclient_t/unittests/blockdump.dict
:type blockDump: dict
"""
... | API to insert a bulk block
:param blockDump: Output of the block dump command, example can be found in https://svnweb.cern.ch/trac/CMSDMWM/browser/DBS/trunk/Client/tests/dbsclient_t/unittests/blockdump.dict
:type blockDump: dict | entailment |
def insertFiles(self, filesList, qInserts=False):
"""
API to insert a list of file into DBS in DBS. Up to 10 files can be inserted in one request.
:param qInserts: True means that inserts will be queued instead of done immediately. INSERT QUEUE Manager will perform the inserts, within few minut... | API to insert a list of file into DBS in DBS. Up to 10 files can be inserted in one request.
:param qInserts: True means that inserts will be queued instead of done immediately. INSERT QUEUE Manager will perform the inserts, within few minutes.
:type qInserts: bool
:param filesList: List of dic... | entailment |
def listFileParentsByLumi(self, **kwargs):
"""
API to list file parents using lumi section info.
:param block_name: name of block that has files who's parents needs to be found (Required)
:type block_name: str
:param logical_file_name: if not all the file parentages under the bl... | API to list file parents using lumi section info.
:param block_name: name of block that has files who's parents needs to be found (Required)
:type block_name: str
:param logical_file_name: if not all the file parentages under the block needed, this lfn list gives the files that needs to find it... | entailment |
def listBlockParents(self, **kwargs):
"""
API to list block parents.
:param block_name: name of block who's parents needs to be found (Required)
:type block_name: str
:returns: List of dictionaries containing following keys (block_name)
:rtype: list of dicts
... | API to list block parents.
:param block_name: name of block who's parents needs to be found (Required)
:type block_name: str
:returns: List of dictionaries containing following keys (block_name)
:rtype: list of dicts | entailment |
def listBlocks(self, **kwargs):
"""
API to list a block in DBS. At least one of the parameters block_name, dataset, data_tier_name or
logical_file_name are required. If data_tier_name is provided, min_cdate and max_cdate have to be specified and
the difference in time have to be less tha... | API to list a block in DBS. At least one of the parameters block_name, dataset, data_tier_name or
logical_file_name are required. If data_tier_name is provided, min_cdate and max_cdate have to be specified and
the difference in time have to be less than 31 days.
:param block_name: name of the b... | entailment |
def listDatasets(self, **kwargs):
"""
API to list dataset(s) in DBS
* You can use ANY combination of these parameters in this API
* In absence of parameters, all valid datasets known to the DBS instance will be returned
:param dataset: Full dataset (path) of the dataset
... | API to list dataset(s) in DBS
* You can use ANY combination of these parameters in this API
* In absence of parameters, all valid datasets known to the DBS instance will be returned
:param dataset: Full dataset (path) of the dataset
:type dataset: str
:param parent_dataset: Ful... | entailment |
def listDatasetArray(self, **kwargs):
"""
API to list datasets in DBS.
:param dataset: list of datasets [dataset1,dataset2,..,dataset n] (Required if dataset_id is not presented), Max length 1000.
:type dataset: list
:param dataset_id: list of dataset_ids that are the primary ke... | API to list datasets in DBS.
:param dataset: list of datasets [dataset1,dataset2,..,dataset n] (Required if dataset_id is not presented), Max length 1000.
:type dataset: list
:param dataset_id: list of dataset_ids that are the primary keys of datasets table: [dataset_id1,dataset_id2,..,dataset_... | entailment |
def listFileArray(self, **kwargs):
"""
API to list files in DBS. Non-wildcarded logical_file_name, non-wildcarded dataset, non-wildcarded block_name or non-wildcarded lfn list is required.
The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported... | API to list files in DBS. Non-wildcarded logical_file_name, non-wildcarded dataset, non-wildcarded block_name or non-wildcarded lfn list is required.
The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported.
* For lumi_list the following two json for... | entailment |
def listPrimaryDSTypes(self, **kwargs):
"""
API to list primary dataset types
:param primary_ds_type: List that primary dataset type (Optional)
:type primary_ds_type: str
:param dataset: List the primary dataset type for that dataset (Optional)
:type dataset: str
... | API to list primary dataset types
:param primary_ds_type: List that primary dataset type (Optional)
:type primary_ds_type: str
:param dataset: List the primary dataset type for that dataset (Optional)
:type dataset: str
:returns: List of dictionaries containing the following key... | entailment |
def listRuns(self, **kwargs):
"""
API to list all run dictionary, for example: [{'run_num': [160578, 160498, 160447, 160379]}].
At least one parameter is mandatory.
:param logical_file_name: List all runs in the file
:type logical_file_name: str
:param block_name: List ... | API to list all run dictionary, for example: [{'run_num': [160578, 160498, 160447, 160379]}].
At least one parameter is mandatory.
:param logical_file_name: List all runs in the file
:type logical_file_name: str
:param block_name: List all runs in the block
:type block_name: st... | entailment |
def updateAcqEraEndDate(self, **kwargs):
"""
API to update the end_date of an acquisition era
:param acquisition_era_name: acquisition_era_name to update (Required)
:type acquisition_era_name: str
:param end_date: end_date not zero (Required)
:type end_date: int
... | API to update the end_date of an acquisition era
:param acquisition_era_name: acquisition_era_name to update (Required)
:type acquisition_era_name: str
:param end_date: end_date not zero (Required)
:type end_date: int | entailment |
def execute(self, conn, logical_file_name='', block_name='', run_num=-1, validFileOnly=0, migration=False):
"""
Lists lumi section numbers with in a file, a list of files or a block.
"""
sql = ""
wheresql = ""
lfn_generator = ""
run_generator = ""
if logical_file_name and not isinsta... | Lists lumi section numbers with in a file, a list of files or a block. | entailment |
def execute(self, conn, child_block_name='', child_lfn_list=[], transaction=False):
sql = ''
binds = {}
child_ds_name = ''
child_where = ''
if child_block_name:
child_ds_name = child_block_name.split('#')[0]
parent_where = " where d.dataset = :child_ds_nam... | cursors = self.dbi.processData(sql, binds, conn, transaction=transaction, returnCursor=True)
for i in cursors:
d = self.formatCursor(i, size=100)
if isinstance(d, list) or isinstance(d, GeneratorType):
for elem in d:
yield elem
elif d:
... | entailment |
def execute(self, conn, run_num=-1, logical_file_name="", block_name="", dataset="", trans=False):
"""
Lists all primary datasets if pattern is not provided.
"""
sql = self.sql
binds = {}
if logical_file_name and "%" not in logical_file_name:
sql += """ inner join %sFILES F... | Lists all primary datasets if pattern is not provided. | entailment |
def find_devices():
"""Return a list of dictionaries. Each dictionary represents one device.
The dictionary contains the following keys: port, unique_id and in_use.
`port` can be used with :func:`open`. `serial_number` is the serial number
of the device (and can also be used with :func:`open`) and `in_... | Return a list of dictionaries. Each dictionary represents one device.
The dictionary contains the following keys: port, unique_id and in_use.
`port` can be used with :func:`open`. `serial_number` is the serial number
of the device (and can also be used with :func:`open`) and `in_use`
indicates whether ... | entailment |
def open(port=None, serial_number=None):
"""Open an aardvark device and return an :class:`Aardvark` object. If the
device cannot be opened an :class:`IOError` is raised.
The `port` can be retrieved by :func:`find_devices`. Usually, the first
device is 0, the second 1, etc.
If you are using only on... | Open an aardvark device and return an :class:`Aardvark` object. If the
device cannot be opened an :class:`IOError` is raised.
The `port` can be retrieved by :func:`find_devices`. Usually, the first
device is 0, the second 1, etc.
If you are using only one device, you can therefore omit the parameter
... | entailment |
def enable_i2c(self):
"""Set this to `True` to enable the hardware I2C interface. If set to
`False` the hardware interface will be disabled and its pins (SDA and
SCL) can be used as GPIOs.
"""
config = self._interface_configuration(CONFIG_QUERY)
return config == CONFIG_GP... | Set this to `True` to enable the hardware I2C interface. If set to
`False` the hardware interface will be disabled and its pins (SDA and
SCL) can be used as GPIOs. | entailment |
def enable_spi(self):
"""Set this to `True` to enable the hardware SPI interface. If set to
`False` the hardware interface will be disabled and its pins (MISO,
MOSI, SCK and SS) can be used as GPIOs.
"""
config = self._interface_configuration(CONFIG_QUERY)
return config =... | Set this to `True` to enable the hardware SPI interface. If set to
`False` the hardware interface will be disabled and its pins (MISO,
MOSI, SCK and SS) can be used as GPIOs. | entailment |
def i2c_bitrate(self):
"""I2C bitrate in kHz. Not every bitrate is supported by the host
adapter. Therefore, the actual bitrate may be less than the value which
is set.
The power-on default value is 100 kHz.
"""
ret = api.py_aa_i2c_bitrate(self.handle, 0)
_raise... | I2C bitrate in kHz. Not every bitrate is supported by the host
adapter. Therefore, the actual bitrate may be less than the value which
is set.
The power-on default value is 100 kHz. | entailment |
def i2c_pullups(self):
"""Setting this to `True` will enable the I2C pullup resistors. If set
to `False` the pullup resistors will be disabled.
Raises an :exc:`IOError` if the hardware adapter does not support
pullup resistors.
"""
ret = api.py_aa_i2c_pullup(self.handle,... | Setting this to `True` will enable the I2C pullup resistors. If set
to `False` the pullup resistors will be disabled.
Raises an :exc:`IOError` if the hardware adapter does not support
pullup resistors. | entailment |
def target_power(self):
"""Setting this to `True` will activate the power pins (4 and 6). If
set to `False` the power will be deactivated.
Raises an :exc:`IOError` if the hardware adapter does not support
the switchable power pins.
"""
ret = api.py_aa_target_power(self.h... | Setting this to `True` will activate the power pins (4 and 6). If
set to `False` the power will be deactivated.
Raises an :exc:`IOError` if the hardware adapter does not support
the switchable power pins. | entailment |
def i2c_bus_timeout(self):
"""I2C bus lock timeout in ms.
Minimum value is 10 ms and the maximum value is 450 ms. Not every value
can be set and will be rounded to the next possible number. You can
read back the property to get the actual value.
The power-on default value is 20... | I2C bus lock timeout in ms.
Minimum value is 10 ms and the maximum value is 450 ms. Not every value
can be set and will be rounded to the next possible number. You can
read back the property to get the actual value.
The power-on default value is 200 ms. | entailment |
def i2c_master_write(self, i2c_address, data, flags=I2C_NO_FLAGS):
"""Make an I2C write access.
The given I2C device is addressed and data given as a string is
written. The transaction is finished with an I2C stop condition unless
I2C_NO_STOP is set in the flags.
10 bit address... | Make an I2C write access.
The given I2C device is addressed and data given as a string is
written. The transaction is finished with an I2C stop condition unless
I2C_NO_STOP is set in the flags.
10 bit addresses are supported if the I2C_10_BIT_ADDR flag is set. | entailment |
def i2c_master_read(self, addr, length, flags=I2C_NO_FLAGS):
"""Make an I2C read access.
The given I2C device is addressed and clock cycles for `length` bytes
are generated. A short read will occur if the device generates an early
NAK.
The transaction is finished with an I2C st... | Make an I2C read access.
The given I2C device is addressed and clock cycles for `length` bytes
are generated. A short read will occur if the device generates an early
NAK.
The transaction is finished with an I2C stop condition unless the
I2C_NO_STOP flag is set. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.