Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def tagReportCallback(llrpMsg):
global tagReport
tags = llrpMsg.msgdict['RO_ACCESS_REPORT']['TagReportData']
if len(tags):
logger.info('saw tag(s): %s', pprint.pformat(tags))
else:
logger.info('no tags seen')
return
for tag in... | [
"Function to run each time the reader reports seeing tags."
] |
Please provide a description of the function:def inventory(host, port, time, report_every_n_tags, antennas, tx_power,
tari, session, mode_identifier,
tag_population, reconnect, tag_filter_mask,
impinj_extended_configuration,
impinj_search_mode, impinj_reports, imp... | [
"Conduct inventory (searching the area around the antennas)."
] |
Please provide a description of the function:def read(filename):
fname = os.path.join(here, filename)
with codecs.open(fname, encoding='utf-8') as f:
return f.read() | [
"\n Get the long description from a file.\n "
] |
Please provide a description of the function:def deserialize(self):
if self.msgbytes is None:
raise LLRPError('No message bytes to deserialize.')
data = self.msgbytes
msgtype, length, msgid = struct.unpack(self.full_hdr_fmt,
dat... | [
"Turns a sequence of bytes into a message dictionary."
] |
Please provide a description of the function:def parseReaderConfig(self, confdict):
logger.debug('parseReaderConfig input: %s', confdict)
conf = {}
for k, v in confdict.items():
if not k.startswith('Parameter'):
continue
ty = v['Type']
... | [
"Parse a reader configuration dictionary.\n\n Examples:\n {\n Type: 23,\n Data: b'\\x00'\n }\n {\n Type: 1023,\n Vendor: 25882,\n Subtype: 21,\n Data: b'\\x00'\n }\n "
] |
Please provide a description of the function:def parseCapabilities(self, capdict):
# check requested antenna set
gdc = capdict['GeneralDeviceCapabilities']
max_ant = gdc['MaxNumberOfAntennaSupported']
if max(self.antennas) > max_ant:
reqd = ','.join(map(str, self.ant... | [
"Parse a capabilities dictionary and adjust instance settings.\n\n At the time this function is called, the user has requested some\n settings (e.g., mode identifier), but we haven't yet asked the reader\n whether those requested settings are within its capabilities. This\n function's jo... |
Please provide a description of the function:def handleMessage(self, lmsg):
logger.debug('LLRPMessage received in state %s: %s', self.state, lmsg)
msgName = lmsg.getName()
lmsg.proto = self
lmsg.peername = self.peername
# call per-message callbacks
logger.debug(... | [
"Implements the LLRP client state machine."
] |
Please provide a description of the function:def startInventory(self, proto=None, force_regen_rospec=False):
if self.state == LLRPClient.STATE_INVENTORYING:
logger.warn('ignoring startInventory() while already inventorying')
return None
rospec = self.getROSpec(force_new... | [
"Add a ROSpec to the reader and enable it."
] |
Please provide a description of the function:def stopPolitely(self, disconnect=False):
logger.info('stopping politely')
if disconnect:
logger.info('will disconnect when stopped')
self.disconnecting = True
self.sendMessage({
'DELETE_ACCESSSPEC': {
... | [
"Delete all active ROSpecs. Return a Deferred that will be called\n when the DELETE_ROSPEC_RESPONSE comes back."
] |
Please provide a description of the function:def parsePowerTable(uhfbandcap):
bandtbl = {k: v for k, v in uhfbandcap.items()
if k.startswith('TransmitPowerLevelTableEntry')}
tx_power_table = [0] * (len(bandtbl) + 1)
for k, v in bandtbl.items():
idx = v['In... | [
"Parse the transmit power table\n\n @param uhfbandcap: Capability dictionary from\n self.capabilities['RegulatoryCapabilities']['UHFBandCapabilities']\n @return: a list of [0, dBm value, dBm value, ...]\n\n >>> LLRPClient.parsePowerTable({'TransmitPowerLevelTableEntry1': \\\n ... |
Please provide a description of the function:def get_tx_power(self, tx_power):
if not self.tx_power_table:
logger.warn('get_tx_power(): tx_power_table is empty!')
return {}
logger.debug('requested tx_power: %s', tx_power)
min_power = self.tx_power_table.index(mi... | [
"Validates tx_power against self.tx_power_table\n\n @param tx_power: index into the self.tx_power_table list; if tx_power\n is 0 then the max power from self.tx_power_table\n @return: a dict {antenna: (tx_power_index, power_dbm)} from\n self.tx_power_table\n @raise: LLRPEr... |
Please provide a description of the function:def setTxPower(self, tx_power):
tx_pow_validated = self.get_tx_power(tx_power)
logger.debug('tx_pow_validated: %s', tx_pow_validated)
needs_update = False
for ant, (tx_pow_idx, tx_pow_dbm) in tx_pow_validated.items():
if s... | [
"Set the transmission power for one or more antennas.\n\n @param tx_power: index into self.tx_power_table\n "
] |
Please provide a description of the function:def pause(self, duration_seconds=0, force=False, force_regen_rospec=False):
logger.debug('pause(%s)', duration_seconds)
if self.state != LLRPClient.STATE_INVENTORYING:
if not force:
logger.info('ignoring pause(); not inven... | [
"Pause an inventory operation for a set amount of time."
] |
Please provide a description of the function:def sendMessage(self, msg_dict):
sent_ids = []
for name in msg_dict:
self.last_msg_id += 1
msg_dict[name]['ID'] = self.last_msg_id
sent_ids.append((name, self.last_msg_id))
llrp_msg = LLRPMessage(msgdict=ms... | [
"Serialize and send a dict LLRP Message\n\n Note: IDs should be modified in original msg_dict as it is a reference.\n That should be ok.\n "
] |
Please provide a description of the function:def buildProtocol(self, addr):
self.resetDelay() # reset reconnection backoff state
clargs = self.client_args.copy()
# optionally configure antennas from self.antenna_dict, which looks
# like {'10.0.0.1:5084': {'1': 'ant1', '2': 'an... | [
"Get a new LLRP client protocol object.\n\n Consult self.antenna_dict to look up antennas to use.\n "
] |
Please provide a description of the function:def setTxPower(self, tx_power, peername=None):
if peername:
protocols = [p for p in self.protocols
if p.peername[0] == peername]
else:
protocols = self.protocols
for proto in protocols:
... | [
"Set the transmit power on one or all readers\n\n If peername is None, set the transmit power for all readers.\n Otherwise, set it for that specific reader.\n "
] |
Please provide a description of the function:def politeShutdown(self):
protoDeferreds = []
for proto in self.protocols:
protoDeferreds.append(proto.stopPolitely(disconnect=True))
return defer.DeferredList(protoDeferreds) | [
"Stop inventory on all connected readers."
] |
Please provide a description of the function:def calculate_check_digit(gtin):
'''Given a GTIN (8-14) or SSCC, calculate its appropriate check digit'''
reverse_gtin = gtin[::-1]
total = 0
count = 0
for char in reverse_gtin:
digit = int(char)
if count % 2 == 0:
digit = digi... | [] |
Please provide a description of the function:def parse_sgtin_96(sgtin_96):
'''Given a SGTIN-96 hex string, parse each segment.
Returns a dictionary of the segments.'''
if not sgtin_96:
raise Exception('Pass in a value.')
if not sgtin_96.startswith("30"):
# not a sgtin, not handled
... | [] |
Please provide a description of the function:def decode_Identification(data):
header_len = struct.calcsize('!HHBH')
msgtype, msglen, idtype, bytecount = struct.unpack(
'!HHBH', data[:header_len])
ret = {}
idtypes = ['MAC Address', 'EPC']
try:
ret['IDType'] = idtypes[idtype]
... | [
"Identification parameter (LLRP 1.1 Section 13.2.2)"
] |
Please provide a description of the function:def decode_param(data):
logger.debug('decode_param data: %r', data)
header_len = struct.calcsize('!HH')
partype, parlen = struct.unpack('!HH', data[:header_len])
pardata = data[header_len:parlen]
logger.debug('decode_param pardata: %r', pardata)
... | [
"Decode any parameter to a byte sequence.\n\n :param data: byte sequence representing an LLRP parameter.\n :returns dict, bytes: where dict is {'Type': <decoded type>, 'Data':\n <decoded data>} and bytes is the remaining bytes trailing the bytes we\n could decode.\n "
] |
Please provide a description of the function:def download_files(file_list):
for _, source_data_file in file_list:
sql_gz_name = source_data_file['name'].split('/')[-1]
msg = 'Downloading: %s' % (sql_gz_name)
log.debug(msg)
new_data = objectstore.get_object(
handelsr... | [
"Download the latest data. "
] |
Please provide a description of the function:def get_connection(store_settings: dict={}) -> Connection:
store = store_settings
if not store_settings:
store = make_config_from_env()
os_options = {
'tenant_id': store['TENANT_ID'],
'region_name': store['REGION_NAME'],
# '... | [
"\n get an objectsctore connection\n "
] |
Please provide a description of the function:def get_object(connection, object_meta_data: dict, dirname: str):
return connection.get_object(dirname, object_meta_data['name'])[1] | [
"\n Download object from objectstore.\n object_meta_data is an object retured when\n using 'get_full_container_list'\n "
] |
Please provide a description of the function:def put_object(
connection, container: str, object_name: str,
contents, content_type: str) -> None:
connection.put_object(
container, object_name, contents=contents,
content_type=content_type) | [
"\n Put file to objectstore\n\n container == \"path/in/store\"\n object_name = \"your_file_name.txt\"\n contents=thefiledata (fileobject) open('ourfile', 'rb')\n content_type='csv' / 'application/json' .. etc\n "
] |
Please provide a description of the function:def delete_object(connection, container: str, object_meta_data: dict) -> None:
connection.delete_object(container, object_meta_data['name']) | [
"\n Delete single object from objectstore\n "
] |
Please provide a description of the function:def return_file_objects(connection, container, prefix='database'):
options = []
meta_data = objectstore.get_full_container_list(
connection, container, prefix='database')
env = ENV.upper()
for o_info in meta_data:
expected_file = f'da... | [
"Given connecton and container find database dumps\n "
] |
Please provide a description of the function:def remove_old_dumps(connection, container: str, days=None):
if not days:
return
if days < 20:
LOG.error('A minimum of 20 backups is stored')
return
options = return_file_objects(connection, container)
for dt, o_info in option... | [
"Remove dumps older than x days\n "
] |
Please provide a description of the function:def download_database(connection, container: str, target: str=""):
meta_data = objectstore.get_full_container_list(
connection, container, prefix='database')
options = return_file_objects(connection, container)
for o_info in meta_data:
exp... | [
"\n Download database dump\n "
] |
Please provide a description of the function:def run(connection):
parser = argparse.ArgumentParser(description=)
parser.add_argument(
'location',
nargs=1,
default=f'{DUMPFOLDER}/database.{ENV}.dump',
help="Dump file location")
parser.add_argument(
'objectstore... | [
"\n Parse arguments and start upload/download\n ",
"\n Process database dumps.\n\n Either download of upload a dump file to the objectstore.\n\n downloads the latest dump and uploads with envronment and date\n into given container destination\n "
] |
Please provide a description of the function:def remember(self, user_name):
'''
Remember the authenticated identity.
This method simply delegates to another IIdentifier plugin if configured.
'''
log.debug('Repoze OAuth remember')
environ = toolkit.request.environ
... | [] |
Please provide a description of the function:def redirect_from_callback(self):
'''Redirect to the callback URL after a successful authentication.'''
state = toolkit.request.params.get('state')
came_from = get_came_from(state)
toolkit.response.status = 302
toolkit.response.locatio... | [] |
Please provide a description of the function:def can_share_folder(self, user, folder):
return folder.parent_id is None and folder.author_id == user.id | [
"\n Return True if `user` can share `folder`.\n "
] |
Please provide a description of the function:def storage_color(self, user_storage):
p = user_storage.percentage
if p >= 0 and p < 60:
return "success"
if p >= 60 and p < 90:
return "warning"
if p >= 90 and p <= 100:
return "danger"
rai... | [
"\n Return labels indicating amount of storage used.\n "
] |
Please provide a description of the function:def folder_created_message(self, request, folder):
messages.success(request, _("Folder {} was created".format(folder))) | [
"\n Send messages.success message after successful folder creation.\n "
] |
Please provide a description of the function:def document_created_message(self, request, document):
messages.success(request, _("Document {} was created".format(document))) | [
"\n Send messages.success message after successful document creation.\n "
] |
Please provide a description of the function:def folder_shared_message(self, request, user, folder):
messages.success(request, _("Folder {} is now shared with {}".format(folder, user))) | [
"\n Send messages.success message after successful share.\n "
] |
Please provide a description of the function:def folder_pre_delete(self, request, folder):
for m in folder.members():
if m.__class__ == folder.__class__:
self.folder_pre_delete(request, m)
m.delete() | [
"\n Perform folder operations prior to deletions. For example, deleting all contents.\n "
] |
Please provide a description of the function:def file_upload_to(self, instance, filename):
ext = filename.split(".")[-1]
filename = "{}.{}".format(uuid.uuid4(), ext)
return os.path.join("document", filename) | [
"\n Callable passed to the FileField's upload_to kwarg on Document.file\n "
] |
Please provide a description of the function:def for_user(self, user):
qs = SharedMemberQuerySet(model=self.model, using=self._db, user=user)
qs = qs.filter(Q(author=user) | Q(foldershareduser__user=user))
return qs.distinct() & self.distinct() | [
"\n All folders the given user can do something with.\n "
] |
Please provide a description of the function:def _parse_list(cls, args):
argparser = ArgumentParser(prog="cluster list")
group = argparser.add_mutually_exclusive_group()
group.add_argument("--id", dest="cluster_id",
help="show cluster with this id")
... | [
"\n Parse command line arguments to construct a dictionary of cluster\n parameters that can be used to determine which clusters to list.\n\n Args:\n `args`: sequence of arguments\n\n Returns:\n Dictionary that can be used to determine which clusters to list\n ... |
Please provide a description of the function:def list(cls, state=None, page=None, per_page=None):
conn = Qubole.agent()
params = {}
if page:
params['page'] = page
if per_page:
params['per_page'] = per_page
if (params.get('page') or params.get('per... | [
"\n List existing clusters present in your account.\n\n Kwargs:\n `state`: list only those clusters which are in this state\n\n Returns:\n List of clusters satisfying the given criteria\n "
] |
Please provide a description of the function:def show(cls, cluster_id_label):
conn = Qubole.agent()
return conn.get(cls.element_path(cluster_id_label)) | [
"\n Show information about the cluster with id/label `cluster_id_label`.\n "
] |
Please provide a description of the function:def status(cls, cluster_id_label):
conn = Qubole.agent(version=Cluster.api_version)
return conn.get(cls.element_path(cluster_id_label) + "/state") | [
"\n Show the status of the cluster with id/label `cluster_id_label`.\n "
] |
Please provide a description of the function:def master(cls, cluster_id_label):
cluster_status = cls.status(cluster_id_label)
if cluster_status.get("state") == 'UP':
return list(filter(lambda x: x["role"] == "master", cluster_status.get("nodes")))[0]
else:
return... | [
"\n Show the details of the master of the cluster with id/label `cluster_id_label`.\n "
] |
Please provide a description of the function:def start(cls, cluster_id_label, api_version=None):
conn = Qubole.agent(version=api_version)
data = {"state": "start"}
return conn.put(cls.element_path(cluster_id_label) + "/state", data) | [
"\n Start the cluster with id/label `cluster_id_label`.\n "
] |
Please provide a description of the function:def terminate(cls, cluster_id_label):
conn = Qubole.agent(version=Cluster.api_version)
data = {"state": "terminate"}
return conn.put(cls.element_path(cluster_id_label) + "/state", data) | [
"\n Terminate the cluster with id/label `cluster_id_label`.\n "
] |
Please provide a description of the function:def _parse_create_update(cls, args, action, api_version):
argparser = ArgumentParser(prog="cluster %s" % action)
create_required = False
label_required = False
if action == "create":
create_required = True
elif a... | [
"\n Parse command line arguments to determine cluster parameters that can\n be used to create or update a cluster.\n\n Args:\n `args`: sequence of arguments\n\n `action`: \"create\", \"update\" or \"clone\"\n\n Returns:\n Object that contains cluster para... |
Please provide a description of the function:def _parse_cluster_manage_command(cls, args, action):
argparser = ArgumentParser(prog="cluster_manage_command")
group = argparser.add_mutually_exclusive_group(required=True)
group.add_argument("--id", dest="cluster_id",
... | [
"\n Parse command line arguments for cluster manage commands.\n "
] |
Please provide a description of the function:def _parse_reassign_label(cls, args):
argparser = ArgumentParser(prog="cluster reassign_label")
argparser.add_argument("destination_cluster",
metavar="destination_cluster_id_label",
help="id/label of the cluster to mo... | [
"\n Parse command line arguments for reassigning label.\n "
] |
Please provide a description of the function:def reassign_label(cls, destination_cluster, label):
conn = Qubole.agent(version=Cluster.api_version)
data = {
"destination_cluster": destination_cluster,
"label": label
}
return conn.pu... | [
"\n Reassign a label from one cluster to another.\n\n Args:\n `destination_cluster`: id/label of the cluster to move the label to\n\n `label`: label to be moved from the source cluster\n "
] |
Please provide a description of the function:def delete(cls, cluster_id_label):
conn = Qubole.agent(version=Cluster.api_version)
return conn.delete(cls.element_path(cluster_id_label)) | [
"\n Delete the cluster with id/label `cluster_id_label`.\n "
] |
Please provide a description of the function:def _parse_snapshot_restore_command(cls, args, action):
argparser = ArgumentParser(prog="cluster %s" % action)
group = argparser.add_mutually_exclusive_group(required=True)
group.add_argument("--id", dest="cluster_id",
... | [
"\n Parse command line arguments for snapshot command.\n "
] |
Please provide a description of the function:def _parse_get_snapshot_schedule(cls, args):
argparser = ArgumentParser(prog="cluster snapshot_schedule")
group = argparser.add_mutually_exclusive_group(required=True)
group.add_argument("--id", dest="cluster_id",
h... | [
"\n Parse command line arguments for updating hbase snapshot schedule or to get details.\n "
] |
Please provide a description of the function:def _parse_update_snapshot_schedule(cls, args):
argparser = ArgumentParser(prog="cluster snapshot_schedule")
group = argparser.add_mutually_exclusive_group(required=True)
group.add_argument("--id", dest="cluster_id",
... | [
"\n Parse command line arguments for updating hbase snapshot schedule or to get details.\n "
] |
Please provide a description of the function:def snapshot(cls, cluster_id_label, s3_location, backup_type):
conn = Qubole.agent(version=Cluster.api_version)
parameters = {}
parameters['s3_location'] = s3_location
if backup_type:
parameters['backup_type'] = backup_typ... | [
"\n Create hbase snapshot full/incremental\n "
] |
Please provide a description of the function:def restore_point(cls, cluster_id_label, s3_location, backup_id, table_names, overwrite=True, automatic=True):
conn = Qubole.agent(version=Cluster.api_version)
parameters = {}
parameters['s3_location'] = s3_location
parameters['backup... | [
"\n Restoring cluster from a given hbase snapshot id\n "
] |
Please provide a description of the function:def update_snapshot_schedule(cls, cluster_id_label, s3_location=None, frequency_unit=None, frequency_num=None, status=None):
conn = Qubole.agent(version=Cluster.api_version)
data = {}
if s3_location is not None:
data["s3_location... | [
"\n Update for snapshot schedule\n "
] |
Please provide a description of the function:def add_node(cls, cluster_id_label, parameters=None):
conn = Qubole.agent(version=Cluster.api_version)
parameters = {} if not parameters else parameters
return conn.post(cls.element_path(cluster_id_label) + "/nodes", data={"parameters" : parameters}) | [
"\n Add a node to an existing cluster\n "
] |
Please provide a description of the function:def remove_node(cls, cluster_id_label, private_dns, parameters=None):
conn = Qubole.agent(version=Cluster.api_version)
parameters = {} if not parameters else parameters
data = {"private_dns" : private_dns, "parameters" : parameters}
r... | [
"\n Add a node to an existing cluster\n "
] |
Please provide a description of the function:def update_node(cls, cluster_id_label, command, private_dns, parameters=None):
conn = Qubole.agent(version=Cluster.api_version)
parameters = {} if not parameters else parameters
data = {"command" : command, "private_dns" : private_dns, "param... | [
"\n Add a node to an existing cluster\n "
] |
Please provide a description of the function:def set_ec2_settings(self,
aws_region=None,
aws_availability_zone=None,
vpc_id=None,
subnet_id=None,
master_elastic_ip=None,
... | [
"\n Kwargs:\n\n `aws_region`: AWS region to create the cluster in.\n\n `aws_availability_zone`: The availability zone to create the cluster\n in.\n\n `vpc_id`: The vpc to create the cluster in.\n\n `subnet_id`: The subnet to create the cluster in.\n\n `bastion_no... |
Please provide a description of the function:def set_hadoop_settings(self, master_instance_type=None,
slave_instance_type=None,
initial_nodes=None,
max_nodes=None,
custom_config=None,
... | [
"\n Kwargs:\n\n `master_instance_type`: The instance type to use for the Hadoop master\n node.\n\n `slave_instance_type`: The instance type to use for the Hadoop slave\n nodes.\n\n `initial_nodes`: Number of nodes to start the cluster with.\n\n `max_nodes`: M... |
Please provide a description of the function:def set_spot_instance_settings(self, maximum_bid_price_percentage=None,
timeout_for_request=None,
maximum_spot_instance_percentage=None):
self.hadoop_settings['spot_instance_settings'] = {... | [
"\n Purchase options for spot instances. Valid only when\n `slave_request_type` is hybrid or spot.\n\n `maximum_bid_price_percentage`: Maximum value to bid for spot\n instances, expressed as a percentage of the base price for the\n slave node instance type.\n\n `tim... |
Please provide a description of the function:def set_stable_spot_instance_settings(self, maximum_bid_price_percentage=None,
timeout_for_request=None,
allow_fallback=True):
self.hadoop_settings['stable_spot_instance_sett... | [
"\n Purchase options for stable spot instances.\n\n `maximum_bid_price_percentage`: Maximum value to bid for stable node spot\n instances, expressed as a percentage of the base price\n (applies to both master and slave nodes).\n\n `timeout_for_request`: Timeout for a stabl... |
Please provide a description of the function:def set_security_settings(self,
encrypted_ephemerals=None,
customer_ssh_key=None,
persistent_security_group=None):
self.security_settings['encrypted_ephemerals'] = encr... | [
"\n Kwargs:\n\n `encrypted_ephemerals`: Encrypt the ephemeral drives on the instance.\n\n `customer_ssh_key`: SSH key to use to login to the instances.\n "
] |
Please provide a description of the function:def set_presto_settings(self, enable_presto=None, presto_custom_config=None):
self.presto_settings['enable_presto'] = enable_presto
self.presto_settings['custom_config'] = presto_custom_config | [
"\n Kwargs:\n\n `enable_presto`: Enable Presto on the cluster.\n\n `presto_custom_config`: Custom Presto configuration overrides.\n "
] |
Please provide a description of the function:def set_cluster_info(self, aws_access_key_id=None,
aws_secret_access_key=None,
aws_region=None,
aws_availability_zone=None,
vpc_id=None,
subnet_id=Non... | [
"\n Kwargs:\n\n `aws_access_key_id`: The access key id for customer's aws account. This\n is required for creating the cluster.\n\n `aws_secret_access_key`: The secret access key for customer's aws\n account. This is required for creating the cluster.\n\n `aws_regio... |
Please provide a description of the function:def minimal_payload(self):
payload_dict = self.__dict__
payload_dict.pop("api_version", None)
return util._make_minimal(payload_dict) | [
"\n This method can be used to create the payload which is sent while\n creating or updating a cluster.\n "
] |
Please provide a description of the function:def _handle_error(response):
code = response.status_code
if 200 <= code < 400:
return
if code == 400:
sys.stderr.write(response.text + "\n")
raise BadRequest(response)
elif code == 401:
... | [
"Raise exceptions in response to any http errors\n\n Args:\n response: A Response object\n\n Raises:\n BadRequest: if HTTP error code 400 returned.\n UnauthorizedAccess: if HTTP error code 401 returned.\n ForbiddenAccess: if HTTP error code 403 returned.\n ... |
Please provide a description of the function:def createTemplate(data):
conn = Qubole.agent()
return conn.post(Template.rest_entity_path, data) | [
"\n Create a new template.\n\n Args:\n `data`: json data required for creating a template\n Returns:\n Dictionary containing the details of the template with its ID.\n "
] |
Please provide a description of the function:def editTemplate(id, data):
conn = Qubole.agent()
return conn.put(Template.element_path(id), data) | [
"\n Edit an existing template.\n\n Args:\n `id`: ID of the template to edit\n `data`: json data to be updated\n Returns:\n Dictionary containing the updated details of the template.\n "
] |
Please provide a description of the function:def viewTemplate(id):
conn = Qubole.agent()
return conn.get(Template.element_path(id)) | [
"\n View an existing Template details.\n\n Args:\n `id`: ID of the template to fetch\n \n Returns:\n Dictionary containing the details of the template.\n "
] |
Please provide a description of the function:def submitTemplate(id, data={}):
conn = Qubole.agent()
path = str(id) + "/run"
return conn.post(Template.element_path(path), data) | [
"\n Submit an existing Template.\n\n Args:\n `id`: ID of the template to submit\n `data`: json data containing the input_vars \n Returns:\n Dictionary containing Command Object details. \n "
] |
Please provide a description of the function:def runTemplate(id, data={}):
conn = Qubole.agent()
path = str(id) + "/run"
res = conn.post(Template.element_path(path), data)
cmdType = res['command_type']
cmdId = res['id']
cmdClass = eval(cmdType)
cmd = cmdC... | [
"\n Run an existing Template and waits for the Result.\n Prints result to stdout. \n\n Args:\n `id`: ID of the template to run\n `data`: json data containing the input_vars\n \n Returns: \n An integer as status (0: success, 1: failure)\n "
... |
Please provide a description of the function:def listTemplates(data={}):
conn = Qubole.agent()
url_path = Template.rest_entity_path
page_attr = []
if "page" in data and data["page"] is not None:
page_attr.append("page=%s" % data["page"])
if "per_page" in data... | [
"\n Fetch existing Templates details.\n\n Args:\n `data`: dictionary containing the value of page number and per-page value\n Returns:\n Dictionary containing paging_info and command_templates details\n "
] |
Please provide a description of the function:def edit(args):
tap = DbTap.find(args.id)
options = {}
if not args.name is None:
options["db_name"]=args.name
if args.host is not None:
options["db_host"]=args.host
if args.user is not None:
... | [
" Carefully setup a dict "
] |
Please provide a description of the function:def show(cls, app_id):
conn = Qubole.agent()
return conn.get(cls.element_path(app_id)) | [
"\n Shows an app by issuing a GET request to the /apps/ID endpoint.\n "
] |
Please provide a description of the function:def create(cls, name, config=None, kind="spark"):
conn = Qubole.agent()
return conn.post(cls.rest_entity_path,
data={'name': name, 'config': config, 'kind': kind}) | [
"\n Create a new app.\n\n Args:\n `name`: the name of the app\n\n `config`: a dictionary of key-value pairs\n\n `kind`: kind of the app (default=spark)\n "
] |
Please provide a description of the function:def stop(cls, app_id):
conn = Qubole.agent()
return conn.put(cls.element_path(app_id) + "/stop") | [
"\n Stops an app by issuing a PUT request to the /apps/ID/stop endpoint.\n "
] |
Please provide a description of the function:def delete(cls, app_id):
conn = Qubole.agent()
return conn.delete(cls.element_path(app_id)) | [
"\n Delete an app by issuing a DELETE request to the /apps/ID endpoint.\n "
] |
Please provide a description of the function:def configure(cls, api_token,
api_url="https://api.qubole.com/api/", version="v1.2",
poll_interval=5, skip_ssl_cert_check=False, cloud_name="AWS"):
cls._auth = QuboleAuth(api_token)
cls.api_token = api_token
... | [
"\n Set parameters governing interaction with QDS\n\n Args:\n `api_token`: authorization token for QDS. required\n\n `api_url`: the base URL for QDS API. configurable for testing only\n\n `version`: QDS REST api version. Will be used throughout unless overridden in Qub... |
Please provide a description of the function:def agent(cls, version=None):
reuse_cached_agent = True
if version:
log.debug("api version changed to %s" % version)
cls.rest_url = '/'.join([cls.baseurl.rstrip('/'), version])
reuse_cached_agent = False
else:
... | [
"\n Returns:\n a connection object to make REST calls to QDS\n\n optionally override the `version` of the REST endpoint for advanced\n features available only in the newer version of the API available\n for certain resource end points eg: /v1.3/cluster. When version is... |
Please provide a description of the function:def show(cls, report_name, data):
conn = Qubole.agent()
return conn.get(cls.element_path(report_name), data) | [
"\n Shows a report by issuing a GET request to the /reports/report_name\n endpoint.\n\n Args:\n `report_name`: the name of the report to show\n\n `data`: the parameters for the report\n "
] |
Please provide a description of the function:def get_cluster_request_parameters(cluster_info, cloud_config, engine_config):
'''
Use this to return final minimal request from cluster_info, cloud_config or engine_config objects
Alternatively call util._make_minimal if only one object needs to be i... | [] |
Please provide a description of the function:def set_cluster_info(self,
disallow_cluster_termination=None,
enable_ganglia_monitoring=None,
datadog_api_token=None,
datadog_app_token=None,
node_boo... | [
"\n Args:\n\n `disallow_cluster_termination`: Set this to True if you don't want\n qubole to auto-terminate idle clusters. Use this option with\n extreme caution.\n\n `enable_ganglia_monitoring`: Set this to True if you want to enable\n ... |
Please provide a description of the function:def create(cls, cluster_info):
conn = Qubole.agent(version="v2")
return conn.post(cls.rest_entity_path, data=cluster_info) | [
"\n Create a new cluster using information provided in `cluster_info`.\n "
] |
Please provide a description of the function:def update(cls, cluster_id_label, cluster_info):
conn = Qubole.agent(version="v2")
return conn.put(cls.element_path(cluster_id_label), data=cluster_info) | [
"\n Update the cluster with id/label `cluster_id_label` using information provided in\n `cluster_info`.\n "
] |
Please provide a description of the function:def clone(cls, cluster_id_label, cluster_info):
conn = Qubole.agent(version="v2")
return conn.post(cls.element_path(cluster_id_label) + '/clone', data=cluster_info) | [
"\n Update the cluster with id/label `cluster_id_label` using information provided in\n `cluster_info`.\n "
] |
Please provide a description of the function:def list(cls, label=None, cluster_id=None, state=None, page=None, per_page=None):
if cluster_id is not None:
return cls.show(cluster_id)
if label is not None:
return cls.show(label)
params = {}
if page:
... | [
"\n List existing clusters present in your account.\n\n Kwargs:\n `state`: list only those clusters which are in this state\n `page`: page number\n `per_page`: number of clusters to be retrieved per page\n\n Returns:\n List of clusters satisfying the ... |
Please provide a description of the function:def _download_to_local(boto_conn, s3_path, fp, num_result_dir, delim=None):
'''
Downloads the contents of all objects in s3_path into fp
Args:
`boto_conn`: S3 connection object
`s3_path`: S3 path to be downloaded
`fp`: The file object w... | [] |
Please provide a description of the function:def list(cls, **kwargs):
conn = Qubole.agent()
params = {}
for k in kwargs:
if kwargs[k]:
params[k] = kwargs[k]
params = None if not params else params
return conn.get(cls.rest_entity_path, params=p... | [
"\n List a command by issuing a GET request to the /command endpoint\n\n Args:\n `**kwargs`: Various parameters can be used to filter the commands such as:\n * command_type - HiveQuery, PrestoQuery, etc. The types should be in title case.\n * st... |
Please provide a description of the function:def create(cls, **kwargs):
conn = Qubole.agent()
if kwargs.get('command_type') is None:
kwargs['command_type'] = cls.__name__
if kwargs.get('tags') is not None:
kwargs['tags'] = kwargs['tags'].split(',')
retu... | [
"\n Create a command object by issuing a POST request to the /command endpoint\n Note - this does not wait for the command to complete\n\n Args:\n `**kwargs`: keyword arguments specific to command type\n\n Returns:\n Command object\n "
] |
Please provide a description of the function:def run(cls, **kwargs):
# vars to keep track of actual logs bytes (err, tmp) and new bytes seen in each iteration
err_pointer, tmp_pointer, new_bytes = 0, 0, 0
print_logs_live = kwargs.pop("print_logs_live", None) # We don't want to send thi... | [
"\n Create a command object by issuing a POST request to the /command endpoint\n Waits until the command is complete. Repeatedly polls to check status\n\n Args:\n `**kwargs`: keyword arguments specific to command type\n\n Returns:\n Command object\n "
] |
Please provide a description of the function:def cancel_id(cls, id):
conn = Qubole.agent()
data = {"status": "kill"}
return conn.put(cls.element_path(id), data) | [
"\n Cancels command denoted by this id\n\n Args:\n `id`: command id\n "
] |
Please provide a description of the function:def get_log_id(cls, id):
conn = Qubole.agent()
r = conn.get_raw(cls.element_path(id) + "/logs")
return r.text | [
"\n Fetches log for the command represented by this id\n\n Args:\n `id`: command id\n "
] |
Please provide a description of the function:def get_log(self):
log_path = self.meta_data['logs_resource']
conn = Qubole.agent()
r = conn.get_raw(log_path)
return r.text | [
"\n Fetches log for the command represented by this object\n\n Returns:\n The log as a string\n "
] |
Please provide a description of the function:def get_log_partial(self, err_pointer=0, tmp_pointer=0):
log_path = self.meta_data['logs_resource']
conn = Qubole.agent()
r = conn.get_raw(log_path, params={'err_file_processed':err_pointer, 'tmp_file_processed':tmp_pointer})
if 'err_... | [
"\n Fetches log (full or partial) for the command represented by this object\n Accepts:\n err_pointer(int): Pointer to err text bytes we've received so far, which will be passed to next api call\n to indicate pointer to fetch logs.\n tmp_pointer(int): Same as err_p... |
Please provide a description of the function:def get_results(self, fp=sys.stdout, inline=True, delim=None, fetch=True, qlog=None, arguments=[]):
result_path = self.meta_data['results_resource']
conn = Qubole.agent()
include_header = "false"
if len(arguments) == 1:
... | [
"\n Fetches the result for the command represented by this object\n\n get_results will retrieve results of the command and write to stdout by default.\n Optionally one can write to a filestream specified in `fp`. The `inline` argument\n decides whether the result can be returned as a CRL... |
Please provide a description of the function:def parse(cls, args):
try:
(options, args) = cls.optparser.parse_args(args)
except OptionParsingError as e:
raise ParseError(e.msg, cls.optparser.format_help())
except OptionParsingExit as e:
return None
... | [
"\n Parse command line arguments to construct a dictionary of command\n parameters that can be used to create a command\n\n Args:\n `args`: sequence of arguments\n\n Returns:\n Dictionary that can be used in create method\n\n Raises:\n ParseError: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.