sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def stop(self, unique_id, configs=None):
"""Stop the service. If the deployer has not started a service with`unique_id` the deployer will raise an Exception
There are two configs that will be considered:
'terminate_only': if this config is passed in then this method is the same as terminate(unique_id) (thi... | Stop the service. If the deployer has not started a service with`unique_id` the deployer will raise an Exception
There are two configs that will be considered:
'terminate_only': if this config is passed in then this method is the same as terminate(unique_id) (this is also the
behavior if stop_command is No... | entailment |
def uninstall(self, unique_id, configs=None):
"""uninstall the service. If the deployer has not started a service with
`unique_id` this will raise a DeploymentError. This considers one config:
'additional_directories': a list of directories to remove in addition to those provided in the constructor plus
... | uninstall the service. If the deployer has not started a service with
`unique_id` this will raise a DeploymentError. This considers one config:
'additional_directories': a list of directories to remove in addition to those provided in the constructor plus
the install path. This will update the directorie... | entailment |
def get_pid(self, unique_id, configs=None):
"""Gets the pid of the process with `unique_id`. If the deployer does not know of a process
with `unique_id` then it should return a value of constants.PROCESS_NOT_RUNNING_PID
"""
RECV_BLOCK_SIZE = 16
# the following is necessay to set the configs for thi... | Gets the pid of the process with `unique_id`. If the deployer does not know of a process
with `unique_id` then it should return a value of constants.PROCESS_NOT_RUNNING_PID | entailment |
def get_host(self, unique_id):
"""Gets the host of the process with `unique_id`. If the deployer does not know of a process
with `unique_id` then it should return a value of SOME_SENTINAL_VALUE
:Parameter unique_id: the name of the process
:raises NameError if the name is not valid process
"""
... | Gets the host of the process with `unique_id`. If the deployer does not know of a process
with `unique_id` then it should return a value of SOME_SENTINAL_VALUE
:Parameter unique_id: the name of the process
:raises NameError if the name is not valid process | entailment |
def kill_all_process(self):
""" Terminates all the running processes. By default it is set to false.
Users can set to true in config once the method to get_pid is done deterministically
either using pid_file or an accurate keyword
"""
if (runtime.get_active_config("cleanup_pending_process",False)):... | Terminates all the running processes. By default it is set to false.
Users can set to true in config once the method to get_pid is done deterministically
either using pid_file or an accurate keyword | entailment |
def string_to_level(log_level):
"""
Converts a string to the corresponding log level
"""
if (log_level.strip().upper() == "DEBUG"):
return logging.DEBUG
if (log_level.strip().upper() == "INFO"):
return logging.INFO
if (log_level.strip().upper() == "WARNING"):
return logging.WARNING
if (log_lev... | Converts a string to the corresponding log level | entailment |
def main():
"""
Parse command line arguments and then run the test suite
"""
parser = argparse.ArgumentParser(description='A distributed test framework')
parser.add_argument('testfile',
help='The file that is used to determine the test suite run')
parser.add_argument('--test-only',
nargs='*',
... | Parse command line arguments and then run the test suite | entailment |
def reset_all():
"""
Clear relevant globals to start fresh
:return:
"""
global _username
global _password
global _active_config
global _active_tests
global _machine_names
global _deployers
reset_deployers()
reset_collector()
_username = None
_password = None
_active_config = None
_active... | Clear relevant globals to start fresh
:return: | entailment |
def get_active_config(config_option, default=None):
"""
gets the config value associated with the config_option or returns an empty string if the config is not found
:param config_option:
:param default: if not None, will be used
:return: value of config. If key is not in config, then default will be used if ... | gets the config value associated with the config_option or returns an empty string if the config is not found
:param config_option:
:param default: if not None, will be used
:return: value of config. If key is not in config, then default will be used if default is not set to None.
Otherwise, KeyError is thrown... | entailment |
def generate(self):
"""
Generates the report
"""
self._setup()
header_html = self._generate_header()
footer_html = self._generate_footer()
results_topbar_html = self._generate_topbar("results")
summary_topbar_html = self._generate_topbar("summary")
logs_topbar_html = self._generate_... | Generates the report | entailment |
def execute ( self, conn, dataset, dataset_access_type, transaction=False ):
"""
for a given file
"""
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/Dataset/UpdateType. Expects db connection from upper layer.", self.logger.exception)
bin... | for a given file | entailment |
def inputChecks(**_params_):
"""
This is a function to check all the input for GET APIs.
"""
def checkTypes(_func_, _params_ = _params_):
log = clog.error_log
@wraps(_func_)
def wrapped(*args, **kw):
arg_names = _func_.__code__.co_varnames[:_func_.__code__.co_argcount... | This is a function to check all the input for GET APIs. | entailment |
def validateStringInput(input_key,input_data, read=False):
"""
To check if a string has the required format. This is only used for POST APIs.
"""
log = clog.error_log
func = None
if '*' in input_data or '%' in input_data:
func = validationFunctionWildcard.get(input_key)
if func i... | To check if a string has the required format. This is only used for POST APIs. | entailment |
def execute(self, conn, transaction=False):
"""
Lists all primary datasets if pattern is not provided.
"""
sql = self.sql
binds = {}
cursors = self.dbi.processData(sql, binds, conn, transaction, returnCursor=True)
result = []
for c in cursors:
... | Lists all primary datasets if pattern is not provided. | entailment |
def execute(self, conn, daoinput, transaction = False):
"""
daoinput keys:
migration_request_id
"""
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationRequests/Remove. Expects db connection from upper layer.",
self... | daoinput keys:
migration_request_id | entailment |
def jsonstreamer(func):
"""JSON streamer decorator"""
def wrapper (self, *args, **kwds):
gen = func (self, *args, **kwds)
yield "["
firstItem = True
for item in gen:
if not firstItem:
yield ","
else:
firstItem = False
... | JSON streamer decorator | entailment |
def decodeLumiIntervals(self, lumi_list):
"""lumi_list must be of one of the two following formats:
'[[a,b], [c,d],' or
[a1, a2, a3] """
errmessage = "lumi intervals must be of one of the two following formats: '[[a,b], [c,d], ...],' or [a1, a2, a3 ...] "
if isinstance(lumi_list, basestring):
... | lumi_list must be of one of the two following formats:
'[[a,b], [c,d],' or
[a1, a2, a3] | entailment |
def listDatasetAccessTypes(self, dataset_access_type=""):
"""
List dataset access types
"""
if isinstance(dataset_access_type, basestring):
try:
dataset_access_type = str(dataset_access_type)
except:
dbsExceptionHandler('dbsExce... | List dataset access types | entailment |
def block_before(self):
"""
Check the current request and block it if the IP address it's
coming from is blacklisted.
"""
# To avoid unnecessary database queries, ignore the IP check for
# requests for static files
if request.path.startswith(url_for('static', file... | Check the current request and block it if the IP address it's
coming from is blacklisted. | entailment |
def matches_ip(self, ip):
"""Return True if the given IP is blacklisted, False otherwise."""
# Check the cache if caching is enabled
if self.cache is not None:
matches_ip = self.cache.get(ip)
if matches_ip is not None:
return matches_ip
# Query M... | Return True if the given IP is blacklisted, False otherwise. | entailment |
def execute(self, conn, logical_file_name, block_name, block_id, transaction=False):
"""
Lists all primary datasets if pattern is not provided.
"""
binds = {}
sql = ''
if logical_file_name:
if isinstance(logical_file_name, basestring):
wheresq... | Lists all primary datasets if pattern is not provided. | entailment |
def listAcquisitionEras(self, acq=''):
"""
Returns all acquistion eras in dbs
"""
try:
acq = str(acq)
except:
dbsExceptionHandler('dbsException-invalid-input', 'acquistion_era_name given is not valid : %s' %acq)
conn = self.dbi.connection()
... | Returns all acquistion eras in dbs | entailment |
def listAcquisitionEras_CI(self, acq=''):
"""
Returns all acquistion eras in dbs
"""
try:
acq = str(acq)
except:
dbsExceptionHandler('dbsException-invalid-input', 'aquistion_era_name given is not valid : %s'%acq)
conn = self.dbi.connection()
... | Returns all acquistion eras in dbs | entailment |
def insertAcquisitionEra(self, businput):
"""
Input dictionary has to have the following keys:
acquisition_era_name, creation_date, create_by, start_date, end_date.
it builds the correct dictionary for dao input and executes the dao
"""
conn = self.dbi.connection()
... | Input dictionary has to have the following keys:
acquisition_era_name, creation_date, create_by, start_date, end_date.
it builds the correct dictionary for dao input and executes the dao | entailment |
def UpdateAcqEraEndDate(self, acquisition_era_name ="", end_date=0):
"""
Input dictionary has to have the following keys:
acquisition_era_name, end_date.
"""
if acquisition_era_name =="" or end_date==0:
dbsExceptionHandler('dbsException-invalid-input', "acquisition_er... | Input dictionary has to have the following keys:
acquisition_era_name, end_date. | entailment |
def execute(self, conn, app="", release_version="", pset_hash="", output_label="",
global_tag='', transaction = False):
"""
returns id for a given application
"""
sql = self.sql
binds = {}
setAnd=False
if not app == "":
sql += " A.APP_NAME=:app_name"
binds[... | returns id for a given application | entailment |
def prepareDatasetMigrationList(self, conn, request):
"""
Prepare the ordered lists of blocks based on input DATASET (note Block is different)
1. Get list of blocks from source
2. Check and see if these blocks are already at DST
3. Check if dataset has parents
... | Prepare the ordered lists of blocks based on input DATASET (note Block is different)
1. Get list of blocks from source
2. Check and see if these blocks are already at DST
3. Check if dataset has parents
4. Check if parent blocks are already at DST | entailment |
def processDatasetBlocks(self, url, conn, inputdataset, order_counter):
"""
Utility function, that comapares blocks of a dataset at source and dst
and returns an ordered list of blocks not already at dst for migration
"""
ordered_dict = {}
srcblks = self.getSrcBlocks(url,... | Utility function, that comapares blocks of a dataset at source and dst
and returns an ordered list of blocks not already at dst for migration | entailment |
def getParentDatasetsOrderedList(self, url, conn, dataset, order_counter):
"""
check if input dataset has parents,
check if any of the blocks are already at dst,
prepare the ordered list and return it.
url : source DBS url
dataset : to be migrated dataset
order_co... | check if input dataset has parents,
check if any of the blocks are already at dst,
prepare the ordered list and return it.
url : source DBS url
dataset : to be migrated dataset
order_counter: the order in which migration happends. | entailment |
def prepareBlockMigrationList(self, conn, request):
"""
Prepare the ordered lists of blocks based on input BLOCK
1. see if block already exists at dst (no need to migrate),
raise "ALREADY EXISTS"
2. see if block exists at src & make sure the block's open_for_writin... | Prepare the ordered lists of blocks based on input BLOCK
1. see if block already exists at dst (no need to migrate),
raise "ALREADY EXISTS"
2. see if block exists at src & make sure the block's open_for_writing=0
3. see if block has parents
4. see if parent... | entailment |
def removeMigrationRequest(self, migration_rqst):
"""
Method to remove pending or failed migration request from the queue.
"""
conn = self.dbi.connection()
try:
tran = conn.begin()
self.mgrremove.execute(conn, migration_rqst)
tran.commit()
... | Method to remove pending or failed migration request from the queue. | entailment |
def insertMigrationRequest(self, request):
"""
Method to insert use requests to MIGRATION_REQUESTS table.
request keys: migration_url, migration_input
"""
conn = self.dbi.connection()
# check if already queued.
#If the migration_input is the same, but the src url ... | Method to insert use requests to MIGRATION_REQUESTS table.
request keys: migration_url, migration_input | entailment |
def listMigrationRequests(self, migration_request_id="", block_name="",
dataset="", user="", oldest=False):
"""
get the status of the migration
migratee : can be dataset or block_name
"""
conn = self.dbi.connection()
migratee = ""
tr... | get the status of the migration
migratee : can be dataset or block_name | entailment |
def listMigrationBlocks(self, migration_request_id=""):
"""
get eveything of block that is has status = 0 and migration_request_id as specified.
"""
conn = self.dbi.connection()
try:
return self.mgrblklist.execute(conn, migration_request_id=migration_request_id)
... | get eveything of block that is has status = 0 and migration_request_id as specified. | entailment |
def updateMigrationRequestStatus(self, migration_status, migration_request_id):
"""
migration_status:
0=PENDING
1=IN PROGRESS
2=COMPLETED
3=FAILED (will be retried)
9=Terminally FAILED
status change:
0 -> 1
1 -> 2
1 -> 3
1 ... | migration_status:
0=PENDING
1=IN PROGRESS
2=COMPLETED
3=FAILED (will be retried)
9=Terminally FAILED
status change:
0 -> 1
1 -> 2
1 -> 3
1 -> 9
are only allowed changes for working through migration.
3 -> 1 is allowed for r... | entailment |
def updateMigrationBlockStatus(self, migration_status=0, migration_block=None, migration_request=None):
"""
migration_status:
0=PENDING
1=IN PROGRESS
2=COMPLETED
3=FAILED (will be retried)
9=Terminally FAILED
status change:
0 -> 1
1 -> 2
... | migration_status:
0=PENDING
1=IN PROGRESS
2=COMPLETED
3=FAILED (will be retried)
9=Terminally FAILED
status change:
0 -> 1
1 -> 2
1 -> 3
1 -> 9
are only allowed changes for working through migration.
3 -> 1 allowed for retry... | entailment |
def getSrcDatasetParents(self, url, dataset):
"""
List block at src DBS
"""
#resturl = "%s/datasetparents?dataset=%s" % (url, dataset)
params={'dataset':dataset}
return cjson.decode(self.callDBSService(url, 'datasetparents', params, {})) | List block at src DBS | entailment |
def getSrcBlockParents(self, url, block):
"""
List block at src DBS
"""
#blockname = block.replace("#", urllib.quote_plus('#'))
#resturl = "%s/blockparents?block_name=%s" % (url, blockname)
params={'block_name':block}
return cjson.decode(self.callDBSService(url, '... | List block at src DBS | entailment |
def getSrcBlocks(self, url, dataset="", block=""):
"""
Need to list all blocks of the dataset and its parents starting from the top
For now just list the blocks from this dataset.
Client type call...
"""
if block:
params={'block_name':block, 'open_for_writing'... | Need to list all blocks of the dataset and its parents starting from the top
For now just list the blocks from this dataset.
Client type call... | entailment |
def executeSingle( self, conn, daoinput, tablename, transaction = False):
"""build dynamic sql based on daoinput"""
sql1 = " insert into %s%s( " %(self.owner, tablename)
sql2 =" values("
"Now loop over all the input keys. We need to check if all the keys are valid !!!"
for key in daoinput:
sq... | build dynamic sql based on daoinput | entailment |
def _cast_boolean(self, value):
"""
Helper to convert config values to boolean as ConfigParser do.
"""
if value.lower() not in self._BOOLEANS:
raise ValueError('Not a boolean: %s' % value)
return self._BOOLEANS[value.lower()] | Helper to convert config values to boolean as ConfigParser do. | entailment |
def get(self, option, default=undefined, cast=undefined):
"""
Return the value for option or default if defined.
"""
if option in self.repository:
value = self.repository.get(option)
else:
value = default
if isinstance(value, Undefined):
... | Return the value for option or default if defined. | entailment |
def parse_requirements(requirements_file):
"""
Create a list for the 'install_requires' component of the setup function
by parsing a requirements file
"""
if os.path.exists(requirements_file):
# return a list that contains each line of the requirements file
return open(requireme... | Create a list for the 'install_requires' component of the setup function
by parsing a requirements file | entailment |
def execute(self, conn, 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, transaction = False):
"""
dataset: /a/b/c
block:... | dataset: /a/b/c
block: /a/b/c#d | entailment |
def execute(self, conn, dsType = "", dataset="", transaction = False):
"""
Lists all primary dataset types if no user input is provided.
"""
sql = self.sql
binds={}
if not dsType and not dataset:
pass
elif dsType and dataset in ("", None, '%'):
... | Lists all primary dataset types if no user input is provided. | entailment |
def execute(self, conn, dataset="", logical_file_name="", app="", release_version="", pset_hash="",
output_label ="", block_id=0, global_tag='', transaction = False):
"""
returns id for a given application
"""
#sql=self.sql
binds = {}
setAnd=False
#add search only b... | returns id for a given application | entailment |
def execute(self, conn, block_name="", transaction = False):
"""
block: /a/b/c#d
"""
if not conn:
msg='Oracle/BlockParent/List. No DB connection found'
dbsExceptionHandler('dbsException-failed-connect2host', msg, self.logger.exception)
sql = self.sql
... | block: /a/b/c#d | entailment |
def listFileLumis(self, logical_file_name="", block_name="", run_num=-1, validFileOnly=0, input_body=-1):
"""
optional parameter: logical_file_name, block_name, validFileOnly
returns: logical_file_name, file_lumi_id, run_num, lumi_section_num
"""
if((logical_file_name=='' or '*'i... | optional parameter: logical_file_name, block_name, validFileOnly
returns: logical_file_name, file_lumi_id, run_num, lumi_section_num | entailment |
def listFileSummary(self, block_name="", dataset="", run_num=-1, validFileOnly=0, sumOverLumi=0):
"""
required parameter: full block_name or dataset name. No wildcards allowed. run_num is optional.
"""
if not block_name and not dataset:
msg = "Block_name or dataset is requir... | required parameter: full block_name or dataset name. No wildcards allowed. run_num is optional. | entailment |
def listFileParents(self, logical_file_name="", block_id=0, block_name=""):
"""
required parameter: logical_file_name or block_name
returns: this_logical_file_name, parent_logical_file_name, parent_file_id
"""
#self.logger.debug("lfn %s, block_name %s, block_id :%s" % (logical_fi... | required parameter: logical_file_name or block_name
returns: this_logical_file_name, parent_logical_file_name, parent_file_id | entailment |
def listFileParentsByLumi(self, block_name='', logical_file_name=[]):
"""
required parameter: block_name
returns: [{child_parent_id_list: [(cid1, pid1), (cid2, pid2), ... (cidn, pidn)]}]
"""
#self.logger.debug("lfn %s, block_name %s" % (logical_file_name, block_name))
if... | required parameter: block_name
returns: [{child_parent_id_list: [(cid1, pid1), (cid2, pid2), ... (cidn, pidn)]}] | entailment |
def listFileChildren(self, logical_file_name='', block_name='', block_id=0):
"""
required parameter: logical_file_name or block_name or block_id
returns: logical_file_name, child_logical_file_name, parent_file_id
"""
conn = self.dbi.connection()
try:
if not lo... | required parameter: logical_file_name or block_name or block_id
returns: logical_file_name, child_logical_file_name, parent_file_id | entailment |
def updateStatus(self, logical_file_name, is_file_valid, lost, dataset):
"""
Used to toggle the status of a file from is_file_valid=1 (valid) to is_file_valid=0 (invalid)
"""
conn = self.dbi.connection()
trans = conn.begin()
try :
self.updatestatus.execute(co... | Used to toggle the status of a file from is_file_valid=1 (valid) to is_file_valid=0 (invalid) | 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, input_body=-1):
"""
... | One of below parameter groups must be present:
non-patterned dataset, non-patterned block, non-patterned dataset with lfn, non-patterned block with lfn,
non-patterned lfn
non-patterned lfn list | entailment |
def insertFile(self, businput, qInserts=False):
"""
This method supports bulk insert of files
performing other operations such as setting Block and Dataset parentages,
setting mapping between OutputConfigModules and File(s) etc.
:param qInserts: True means that inserts will be q... | This method supports bulk insert of files
performing other operations such as setting Block and Dataset parentages,
setting mapping between OutputConfigModules and File(s) etc.
:param qInserts: True means that inserts will be queued instead of done immediately. INSERT QUEUE Manager will perform... | entailment |
def insertFileParents(self, businput):
"""
This is a special function for WMAgent only.
input block_name: is a child block name.
input chils_parent_id_list: is a list of file id of child, parent pair: [[cid1, pid1],[cid2,pid2],[cid3,pid3],...]
The requirment for this API... | This is a special function for WMAgent only.
input block_name: is a child block name.
input chils_parent_id_list: is a list of file id of child, parent pair: [[cid1, pid1],[cid2,pid2],[cid3,pid3],...]
The requirment for this API is
1. All the child files belong to the block.
... | entailment |
def increment(self, conn, seqName, transaction = False, incCount=1):
"""
increments the sequence `seqName` by default `Incremented by`
and returns its value
incCount: is UNUSED variable in Oracle implementation
"""
#FIXME: Do we need to lock the tables here?
sql... | increments the sequence `seqName` by default `Incremented by`
and returns its value
incCount: is UNUSED variable in Oracle implementation | entailment |
def listReleaseVersions(self, release_version="", dataset='', logical_file_name=''):
"""
List release versions
"""
if dataset and ('%' in dataset or '*' in dataset):
dbsExceptionHandler('dbsException-invalid-input',
" DBSReleaseVersion/listReleaseVersions. No ... | List release versions | entailment |
def __search_ca_path(self):
"""
Get CA Path to check the validity of the server host certificate on the client side
"""
if "X509_CERT_DIR" in os.environ:
self._ca_path = os.environ['X509_CERT_DIR']
elif os.path.exists('/etc/grid-security/certificates'):
s... | Get CA Path to check the validity of the server host certificate on the client side | entailment |
def __search_cert_key(self):
"""
Get the user credentials if they exist, otherwise throw an exception.
This code was modified from DBSAPI/dbsHttpService.py and WMCore/Services/Requests.py
"""
# Now we're trying to guess what the right cert/key combo is...
# First preferen... | Get the user credentials if they exist, otherwise throw an exception.
This code was modified from DBSAPI/dbsHttpService.py and WMCore/Services/Requests.py | entailment |
def authInsert(user, role, group, site):
"""
Authorization function for general insert
"""
if not role: return True
for k, v in user['roles'].iteritems():
for g in v['group']:
if k in role.get(g, '').split(':'):
return True
return False | Authorization function for general insert | entailment |
def submit(self):
"""
Interface for submitting a migration request.
Required input keys:
MIGRATION_URL: The source DBS url for migration.
MIGRATION_INPUT: The block or dataset names to be migrated.
"""
body = request.body.read()
indata = cjson.decode(body)... | Interface for submitting a migration request.
Required input keys:
MIGRATION_URL: The source DBS url for migration.
MIGRATION_INPUT: The block or dataset names to be migrated. | entailment |
def status(self, migration_rqst_id="", block_name="", dataset="", user=""):
"""
Interface to query status of a migration request
In this preference order of input parameters :
migration_rqst_id, block, dataset, user
(if multi parameters are provided, only the precedence o... | Interface to query status of a migration request
In this preference order of input parameters :
migration_rqst_id, block, dataset, user
(if multi parameters are provided, only the precedence order is followed) | entailment |
def remove(self):
"""
Interface to remove a migration request from the queue.
Only Permanent FAILED/9 and PENDING/0 requests can be removed
(running and sucessed requests cannot be removed)
"""
body = request.body.read()
indata = cjson.decode(body)
try:
... | Interface to remove a migration request from the queue.
Only Permanent FAILED/9 and PENDING/0 requests can be removed
(running and sucessed requests cannot be removed) | entailment |
def execute(self, conn, logical_file_name='', block_id=0, block_name='', transaction=False):
"""
return {} if condition is not provided.
"""
sql = ''
binds = {}
if logical_file_name:
if isinstance(logical_file_name, basestring):
wheresql = "WH... | return {} if condition is not provided. | entailment |
def listDatasetParents(self, dataset=""):
"""
takes required dataset parameter
returns only parent dataset name
"""
if( dataset == "" ):
dbsExceptionHandler("dbsException-invalid-input", "DBSDataset/listDatasetParents. Child Dataset name is required.")
conn = ... | takes required dataset parameter
returns only parent dataset name | entailment |
def listDatasetChildren(self, dataset):
"""
takes required dataset parameter
returns only children dataset name
"""
if( dataset == "" ):
dbsExceptionHandler("dbsException-invalid-input", "DBSDataset/listDatasetChildren. Parent Dataset name is required.")
conn ... | takes required dataset parameter
returns only children dataset name | entailment |
def updateStatus(self, dataset, is_dataset_valid):
"""
Used to toggle the status of a dataset is_dataset_valid=0/1 (invalid/valid)
"""
if( dataset == "" ):
dbsExceptionHandler("dbsException-invalid-input", "DBSDataset/updateStatus. dataset is required.")
conn = self... | Used to toggle the status of a dataset is_dataset_valid=0/1 (invalid/valid) | entailment |
def updateType(self, dataset, dataset_access_type):
"""
Used to change the status of a dataset type (production/etc.)
"""
if( dataset == "" ):
dbsExceptionHandler("dbsException-invalid-input", "DBSDataset/updateType. dataset is required.")
conn = self.dbi.connection(... | Used to change the status of a dataset type (production/etc.) | 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="", run_num=-1, physics_group_name="",
... | lists all datasets if dataset parameter is not given.
The parameter can include % character.
all other parameters are not wild card ones. | entailment |
def insertDataset(self, businput):
"""
input dictionary must have the following keys:
dataset, primary_ds_name(name), processed_ds(name), data_tier(name),
acquisition_era(name), processing_version
It may have following keys:
physics_group(name), xtcrosssection, creation_d... | input dictionary must have the following keys:
dataset, primary_ds_name(name), processed_ds(name), data_tier(name),
acquisition_era(name), processing_version
It may have following keys:
physics_group(name), xtcrosssection, creation_date, create_by,
last_modification_date, last_m... | entailment |
def execute(self, conn, block_name, origin_site_name, transaction=False):
"""
Update origin_site_name for a given block_name
"""
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/Block/UpdateStatus. \
Expects db connection from upper layer.", self.l... | Update origin_site_name for a given block_name | entailment |
def increment(self, conn, seqName, transaction = False, incCount=1):
"""
increments the sequence `seqName` by default `Incremented by one`
and returns its value
"""
try:
seqTable = "%sS" %seqName
tlock = "lock tables %s write" %seqTable
self.dbi.processData(tlock, [], con... | increments the sequence `seqName` by default `Incremented by one`
and returns its value | entailment |
def listRuns(self, run_num=-1, logical_file_name="",
block_name="", dataset=""):
"""
List run known to DBS.
"""
if( '%' in logical_file_name or '%' in block_name or '%' in dataset ):
dbsExceptionHandler('dbsException-invalid-input',
... | List run known to DBS. | entailment |
def insertPrimaryDataset(self):
"""
API to insert A primary dataset in DBS
:param primaryDSObj: primary dataset object
:type primaryDSObj: dict
:key primary_ds_type: TYPE (out of valid types in DBS, MC, DATA) (Required)
:key primary_ds_name: Name of the primary dataset (... | API to insert A primary dataset in DBS
:param primaryDSObj: primary dataset object
:type primaryDSObj: dict
:key primary_ds_type: TYPE (out of valid types in DBS, MC, DATA) (Required)
:key primary_ds_name: Name of the primary dataset (Required) | entailment |
def updateAcqEraEndDate(self, acquisition_era_name ="", end_date=0):
"""
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)
... | 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 insertBulkBlock(self):
"""
API to insert a bulk block
:param blockDump: Output of the block dump command
:type blockDump: dict
"""
try:
body = request.body.read()
indata = cjson.decode(body)
if (indata.get("file_parent_list", []) ... | API to insert a bulk block
:param blockDump: Output of the block dump command
:type blockDump: dict | entailment |
def insertBlock(self):
"""
API to insert a block into DBS
:param blockObj: Block object
:type blockObj: dict
:key open_for_writing: Open For Writing (1/0) (Optional, default 1)
:key block_size: Block Size (Optional, default 0)
:key file_count: File Count (Optiona... | API to insert a block into DBS
:param blockObj: Block object
:type blockObj: dict
:key open_for_writing: Open For Writing (1/0) (Optional, default 1)
:key block_size: Block Size (Optional, default 0)
:key file_count: File Count (Optional, default 0)
:key block_name: Bloc... | entailment |
def insertFile(self, 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 minutes.
... | 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 updateFile(self, logical_file_name=[], is_file_valid=1, lost=0, dataset=''):
"""
API to update file status
:param logical_file_name: logical_file_name to update (optional), but must have either a fln or
a dataset
:type logical_file_name: str
:param is_file_valid: va... | API to update file status
:param logical_file_name: logical_file_name to update (optional), but must have either a fln or
a dataset
:type logical_file_name: str
:param is_file_valid: valid=1, invalid=0 (Required)
:type is_file_valid: bool
:param lost: default lost=0 (op... | entailment |
def create_from_string(cls, cidr, label=None, whitelist=False):
"""
Converts a CIDR like 192.168.0.0/24 into 2 parts:
start: 3232235520
stop: 3232235775
"""
network = netaddr.IPNetwork(cidr)
start = network.first
stop = start + network.size - 1
... | Converts a CIDR like 192.168.0.0/24 into 2 parts:
start: 3232235520
stop: 3232235775 | entailment |
def qs_for_ip(cls, ip_str):
"""
Returns a queryset with matching IPNetwork objects for the given IP.
"""
ip = int(netaddr.IPAddress(ip_str))
# ignore IPv6 addresses for now (4294967295 is 0xffffffff, aka the
# biggest 32-bit number)
if ip > 4294967295:
... | Returns a queryset with matching IPNetwork objects for the given IP. | entailment |
def matches_ip(cls, ip_str, read_preference=None):
"""
Return True if provided IP exists in the blacklist and doesn't exist
in the whitelist. Otherwise, return False.
"""
qs = cls.qs_for_ip(ip_str).only('whitelist')
if read_preference:
qs = qs.read_preference(... | Return True if provided IP exists in the blacklist and doesn't exist
in the whitelist. Otherwise, return False. | entailment |
def dbsExceptionHandler(eCode='', message='', logger=None , serverError=''):
"""
This utility function handles all dbs exceptions. It will log , raise exception
based on input condition. It loggs the traceback on the server log. Send HTTPError 400
for invalid client input and HTTPError 404 for NOT FOUN... | This utility function handles all dbs exceptions. It will log , raise exception
based on input condition. It loggs the traceback on the server log. Send HTTPError 400
for invalid client input and HTTPError 404 for NOT FOUND required pre-existing condition. | entailment |
def execute(self, conn, block_id="", transaction=False):
"""
simple execute
"""
if not conn:
dbsExceptionHandler("dbsException-db-conn-failed", "Oracle/FileBuffer/List. Expects db connection from upper layer.")
sql = self.sql
binds = { "block_id" : block_id}
cursor... | simple execute | entailment |
def execute(self, conn, primary_ds_name="", primary_ds_type="", transaction=False):
"""
Lists all primary datasets if pattern is not provided.
"""
sql = self.sql
binds = {}
#import pdb
#pdb.set_trace()
if primary_ds_name and primary_ds_type in ('', None, ... | Lists all primary datasets if pattern is not provided. | entailment |
def configure_proxy(self, curl_object):
"""configure pycurl proxy settings"""
curl_object.setopt(curl_object.PROXY, self._proxy_hostname)
curl_object.setopt(curl_object.PROXYPORT, self._proxy_port)
curl_object.setopt(curl_object.PROXYTYPE, curl_object.PROXYTYPE_SOCKS5)
if self._p... | configure pycurl proxy settings | entailment |
def execute( self, conn, daoinput, transaction = False ):
"""
daoinput must be validated to have the following keys:
child_parent_id__list[[cid, pid],...], block_name
"""
binds = {}
bindlist=[]
if isinstance(daoinput, dict) and "block_name" in daoinput.k... | daoinput must be validated to have the following keys:
child_parent_id__list[[cid, pid],...], block_name | entailment |
def execute(self, conn, acquisition_era_name,end_date, transaction = False):
"""
for a given block_id
"""
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "dbs/dao/Oracle/AcquisitionEra/updateEndDate expects db connection from upper layer.", self.logger.exception)
... | for a given block_id | entailment |
def execute(self, conn, daoinput, transaction = False):
"""
daoinput keys:
migration_status, migration_block_id, migration_request_id
"""
#print daoinput['migration_block_id']
if not conn:
dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationBlock/Updat... | daoinput keys:
migration_status, migration_block_id, migration_request_id | entailment |
def execute(self, conn, file_id_list, transaction=False):
"""
file_id_list : file_id_list
"""
sql=self.sql
binds={}
if file_id_list:
count=0
for an_id in file_id_list:
if count > 0: sql += ", "
sql += ":file_id_%s" %count
binds.update({"file_id_%s" %count : an_id})
count+=1
sql += ")"
els... | file_id_list : file_id_list | entailment |
def execute(self, conn, app, release_version, pset_hash, output_label, global_tag, transaction = False):
"""
returns id for a given application
This always requires all four variables to be set, because
you better have them in blockInsert
"""
binds = {}
binds["ap... | returns id for a given application
This always requires all four variables to be set, because
you better have them in blockInsert | entailment |
def dumpBlock(self, block_name):
""" This method is used at source server and gets the
information on a single block that is being migrated.
Try to return in a format to be ready for insert calls"""
if '%' in block_name or '*' in block_name:
msg = "No wildcard is all... | This method is used at source server and gets the
information on a single block that is being migrated.
Try to return in a format to be ready for insert calls | entailment |
def updateStatus(self, block_name="", open_for_writing=0):
"""
Used to toggle the status of a block open_for_writing=1, open for writing, open_for_writing=0, closed
"""
if open_for_writing not in [1, 0, '1', '0']:
msg = "DBSBlock/updateStatus. open_for_writing can only be 0 o... | Used to toggle the status of a block open_for_writing=1, open for writing, open_for_writing=0, closed | entailment |
def updateSiteName(self, block_name, origin_site_name):
"""
Update the origin_site_name for a given block name
"""
if not origin_site_name:
dbsExceptionHandler('dbsException-invalid-input',
"DBSBlock/updateSiteName. origin_site_name is mandator... | Update the origin_site_name for a given block name | entailment |
def listBlockParents(self, block_name=""):
"""
list parents of a block
"""
if not block_name:
msg = " DBSBlock/listBlockParents. Block_name must be provided as a string or a list. \
No wildcards allowed in block_name/s."
dbsExceptionHandler('dbsExc... | list parents of a block | entailment |
def listBlockChildren(self, block_name=""):
"""
list parents of a block
"""
if (not block_name) or re.search("['%','*']", block_name):
dbsExceptionHandler("dbsException-invalid-input", "DBSBlock/listBlockChildren. Block_name must be provided." )
conn = self.dbi.connec... | list parents of a block | 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):
"""
dataset, block_name, data_tier_na... | dataset, block_name, data_tier_name or logical_file_name must be passed. | entailment |
def listBlocksOrigin(self, origin_site_name="", dataset="", block_name=""):
"""
This is the API to list all the blocks/datasets first generated in the site called origin_site_name,
if origin_site_name is provided w/ no wildcards allow. If a fully spelled dataset is provided, then it will
... | This is the API to list all the blocks/datasets first generated in the site called origin_site_name,
if origin_site_name is provided w/ no wildcards allow. If a fully spelled dataset is provided, then it will
only list the blocks first generated from origin_site_name under the given dataset. | entailment |
def insertBlock(self, businput):
"""
Input dictionary has to have the following keys:
blockname
It may have:
open_for_writing, origin_site(name), block_size,
file_count, creation_date, create_by, last_modification_date, last_modified_by
it builds... | Input dictionary has to have the following keys:
blockname
It may have:
open_for_writing, origin_site(name), block_size,
file_count, creation_date, create_by, last_modification_date, last_modified_by
it builds the correct dictionary for dao input and executes th... | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.