sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def _find_files(directory): """ Find XML files in the directory """ pattern = "{directory}/*.xml".format( directory=directory, ) files = glob(pattern) return files
Find XML files in the directory
entailment
def workbench_scenarios(cls): """ Gather scenarios to be displayed in the workbench """ module = cls.__module__ module = module.split('.')[0] directory = pkg_resources.resource_filename(module, 'scenarios') files = _find_files(directory) scenarios = _read_...
Gather scenarios to be displayed in the workbench
entailment
def _set_session(): """ Sets global __SESSION and __USER_ID if they haven't been set """ global __SESSION global __USER_ID if __SESSION is None: try: __SESSION = AuthorizedSession(google.auth.default(['https://www.googleapis.com/auth/userinfo.profile', ...
Sets global __SESSION and __USER_ID if they haven't been set
entailment
def _fiss_agent_header(headers=None): """ Return request headers for fiss. Inserts FISS as the User-Agent. Initializes __SESSION if it hasn't been set. Args: headers (dict): Include additional headers as key-value pairs """ _set_session() fiss_headers = {"User-Agent" : FIS...
Return request headers for fiss. Inserts FISS as the User-Agent. Initializes __SESSION if it hasn't been set. Args: headers (dict): Include additional headers as key-value pairs
entailment
def _check_response_code(response, codes): """ Throws an exception if the http response is not expected. Can check single integer or list of valid responses. Example usage: >>> r = api.get_workspace("broad-firecloud-testing", "Fake-Bucket") >>> _check_response_code(r, 200) ... ...
Throws an exception if the http response is not expected. Can check single integer or list of valid responses. Example usage: >>> r = api.get_workspace("broad-firecloud-testing", "Fake-Bucket") >>> _check_response_code(r, 200) ... FireCloudServerError ...
entailment
def list_entity_types(namespace, workspace): """List the entity types present in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name Swagger: https://api.firecloud.org/#!/Entities/getEntityTypes """ headers = _fiss_agent_he...
List the entity types present in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name Swagger: https://api.firecloud.org/#!/Entities/getEntityTypes
entailment
def upload_entities(namespace, workspace, entity_data): """Upload entities from tab-delimited string. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name entity_data (str): TSV string describing entites Swagger: https://api.firecloud.or...
Upload entities from tab-delimited string. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name entity_data (str): TSV string describing entites Swagger: https://api.firecloud.org/#!/Entities/importEntities
entailment
def upload_entities_tsv(namespace, workspace, entities_tsv): """Upload entities from a tsv loadfile. File-based wrapper for api.upload_entities(). A loadfile is a tab-separated text file with a header row describing entity type and attribute names, followed by rows of entities and their attribute v...
Upload entities from a tsv loadfile. File-based wrapper for api.upload_entities(). A loadfile is a tab-separated text file with a header row describing entity type and attribute names, followed by rows of entities and their attribute values. Ex: entity:participant_id age alive ...
entailment
def copy_entities(from_namespace, from_workspace, to_namespace, to_workspace, etype, enames, link_existing_entities=False): """Copy entities between workspaces Args: from_namespace (str): project (namespace) to which source workspace belongs from_workspace (str): Source worksp...
Copy entities between workspaces Args: from_namespace (str): project (namespace) to which source workspace belongs from_workspace (str): Source workspace name to_namespace (str): project (namespace) to which target workspace belongs to_workspace (str): Target workspace name ...
entailment
def get_entities(namespace, workspace, etype): """List entities of given type in a workspace. Response content will be in JSON format. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type Swagger: https://ap...
List entities of given type in a workspace. Response content will be in JSON format. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type Swagger: https://api.firecloud.org/#!/Entities/getEntities
entailment
def get_entities_tsv(namespace, workspace, etype): """List entities of given type in a workspace as a TSV. Identical to get_entities(), but the response is a TSV. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ...
List entities of given type in a workspace as a TSV. Identical to get_entities(), but the response is a TSV. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type Swagger: https://api.firecloud.org/#!/Entities/br...
entailment
def get_entity(namespace, workspace, etype, ename): """Request entity information. Gets entity metadata and attributes. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ename (str): The entity's unique id ...
Request entity information. Gets entity metadata and attributes. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ename (str): The entity's unique id Swagger: https://api.firecloud.org/#!/Entities/ge...
entailment
def delete_entities(namespace, workspace, json_body): """Delete entities in a workspace. Note: This action is not reversible. Be careful! Args: namespace (str): project to which workspace belongs workspace (str): Workspace name json_body: [ { "entityTy...
Delete entities in a workspace. Note: This action is not reversible. Be careful! Args: namespace (str): project to which workspace belongs workspace (str): Workspace name json_body: [ { "entityType": "string", "entityName": "string" }...
entailment
def delete_entity_type(namespace, workspace, etype, ename): """Delete entities in a workspace. Note: This action is not reversible. Be careful! Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ename (str, or ...
Delete entities in a workspace. Note: This action is not reversible. Be careful! Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ename (str, or iterable of str): unique entity id(s) Swagger: https:/...
entailment
def get_entities_query(namespace, workspace, etype, page=1, page_size=100, sort_direction="asc", filter_terms=None): """Paginated version of get_entities_with_type. Args: namespace (str): project to which workspace belongs workspace (str): Workspace...
Paginated version of get_entities_with_type. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name Swagger: https://api.firecloud.org/#!/Entities/entityQuery
entailment
def update_entity(namespace, workspace, etype, ename, updates): """ Update entity attributes in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ename (str): Entity name updates (lis...
Update entity attributes in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name etype (str): Entity type ename (str): Entity name updates (list(dict)): List of updates to entity from _attr_set, e.g. Swagger: ...
entailment
def list_workspace_configs(namespace, workspace, allRepos=False): """List method configurations in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name Swagger: https://api.firecloud.org/#!/Method_Configurations/listWorkspaceMethodCon...
List method configurations in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name Swagger: https://api.firecloud.org/#!/Method_Configurations/listWorkspaceMethodConfigs DUPLICATE: https://api.firecloud.org/#!/Workspaces/listWorks...
entailment
def create_workspace_config(namespace, workspace, body): """Create method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name body (json) : a filled-in JSON object for the new method config (e.g. see...
Create method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name body (json) : a filled-in JSON object for the new method config (e.g. see return value of get_workspace_config) Swagger: htt...
entailment
def delete_workspace_config(namespace, workspace, cnamespace, config): """Delete method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name mnamespace (str): Method namespace method (str): Method name Swagger...
Delete method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name mnamespace (str): Method namespace method (str): Method name Swagger: https://api.firecloud.org/#!/Method_Configurations/deleteWorkspaceMe...
entailment
def get_workspace_config(namespace, workspace, cnamespace, config): """Get method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Config namespace config (str): Config name Swagger: ...
Get method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Config namespace config (str): Config name Swagger: https://api.firecloud.org/#!/Method_Configurations/getWorkspaceMethodCo...
entailment
def overwrite_workspace_config(namespace, workspace, cnamespace, configname, body): """Add or overwrite method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Configuration namespace config...
Add or overwrite method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Configuration namespace configname (str): Configuration name body (json): new body (definition) of the metho...
entailment
def update_workspace_config(namespace, workspace, cnamespace, configname, body): """Update method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Configuration namespace configname (str): C...
Update method configuration in workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Configuration namespace configname (str): Configuration name body (json): new body (definition) of the method config ...
entailment
def validate_config(namespace, workspace, cnamespace, config): """Get syntax validation for a configuration. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Configuration namespace config (str): Configuration name ...
Get syntax validation for a configuration. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Configuration namespace config (str): Configuration name Swagger: https://api.firecloud.org/#!/Method_Configurations/va...
entailment
def rename_workspace_config(namespace, workspace, cnamespace, config, new_namespace, new_name): """Rename a method configuration in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name mnamespa...
Rename a method configuration in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name mnamespace (str): Config namespace config (str): Config name new_namespace (str): Updated config namespace new_name (str): Updated ...
entailment
def copy_config_from_repo(namespace, workspace, from_cnamespace, from_config, from_snapshot_id, to_cnamespace, to_config): """Copy a method config from the methods repository to a workspace. Args: namespace (str): project to which workspace belongs ...
Copy a method config from the methods repository to a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name from_cnamespace (str): Source configuration namespace from_config (str): Source configuration name from_snapshot_id (int...
entailment
def copy_config_to_repo(namespace, workspace, from_cnamespace, from_config, to_cnamespace, to_config): """Copy a method config from a workspace to the methods repository. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name fr...
Copy a method config from a workspace to the methods repository. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name from_cnamespace (str): Source configuration namespace from_config (str): Source configuration name to_cnamespace (str): ...
entailment
def list_repository_methods(namespace=None, name=None, snapshotId=None): """List method(s) in the methods repository. Args: namespace (str): Method Repository namespace name (str): method name snapshotId (int): method snapshot ID Swagger: https://api.firecloud.org/#!/Method...
List method(s) in the methods repository. Args: namespace (str): Method Repository namespace name (str): method name snapshotId (int): method snapshot ID Swagger: https://api.firecloud.org/#!/Method_Repository/listMethodRepositoryMethods
entailment
def get_config_template(namespace, method, version): """Get the configuration template for a method. The method should exist in the methods repository. Args: namespace (str): Method's namespace method (str): method name version (int): snapshot_id of the method Swagger: ...
Get the configuration template for a method. The method should exist in the methods repository. Args: namespace (str): Method's namespace method (str): method name version (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method_Repository/createMethod...
entailment
def get_inputs_outputs(namespace, method, snapshot_id): """Get a description of the inputs and outputs for a method. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name snapshot_id (int): snapshot_id of the method ...
Get a description of the inputs and outputs for a method. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name snapshot_id (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method_Reposit...
entailment
def get_repository_config(namespace, config, snapshot_id): """Get a method configuration from the methods repository. Args: namespace (str): Methods namespace config (str): config name snapshot_id (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method...
Get a method configuration from the methods repository. Args: namespace (str): Methods namespace config (str): config name snapshot_id (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method_Repository/getMethodRepositoryConfiguration
entailment
def get_repository_method(namespace, method, snapshot_id, wdl_only=False): """Get a method definition from the method repository. Args: namespace (str): Methods namespace method (str): method name version (int): snapshot_id of the method wdl_only (bool): Exclude metadata Sw...
Get a method definition from the method repository. Args: namespace (str): Methods namespace method (str): method name version (int): snapshot_id of the method wdl_only (bool): Exclude metadata Swagger: https://api.firecloud.org/#!/Method_Repository/get_api_methods_name...
entailment
def update_repository_method(namespace, method, synopsis, wdl, doc=None, comment=""): """Create/Update workflow definition. FireCloud will create a new snapshot_id for the given workflow. Args: namespace (str): Methods namespace method (str): method name ...
Create/Update workflow definition. FireCloud will create a new snapshot_id for the given workflow. Args: namespace (str): Methods namespace method (str): method name synopsis (str): short (<80 char) description of method wdl (file): Workflow Description Language file do...
entailment
def delete_repository_method(namespace, name, snapshot_id): """Redacts a method and all of its associated configurations. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name snapshot_id (int): snapshot_id of the meth...
Redacts a method and all of its associated configurations. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name snapshot_id (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method_Reposi...
entailment
def delete_repository_config(namespace, name, snapshot_id): """Redacts a configuration and all of its associated configurations. The configuration should exist in the methods repository. Args: namespace (str): configuration namespace configuration (str): configuration name snapshot...
Redacts a configuration and all of its associated configurations. The configuration should exist in the methods repository. Args: namespace (str): configuration namespace configuration (str): configuration name snapshot_id (int): snapshot_id of the configuration Swagger: h...
entailment
def get_repository_method_acl(namespace, method, snapshot_id): """Get permissions for a method. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name version (int): snapshot_id of the method Swagger: https...
Get permissions for a method. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name version (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method_Repository/getMethodACL
entailment
def update_repository_method_acl(namespace, method, snapshot_id, acl_updates): """Set method permissions. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name snapshot_id (int): snapshot_id of the method acl_u...
Set method permissions. The method should exist in the methods repository. Args: namespace (str): Methods namespace method (str): method name snapshot_id (int): snapshot_id of the method acl_updates (list(dict)): List of access control updates Swagger: https://api....
entailment
def get_repository_config_acl(namespace, config, snapshot_id): """Get configuration permissions. The configuration should exist in the methods repository. Args: namespace (str): Configuration namespace config (str): Configuration name snapshot_id (int): snapshot_id of the method ...
Get configuration permissions. The configuration should exist in the methods repository. Args: namespace (str): Configuration namespace config (str): Configuration name snapshot_id (int): snapshot_id of the method Swagger: https://api.firecloud.org/#!/Method_Repository/get...
entailment
def update_repository_config_acl(namespace, config, snapshot_id, acl_updates): """Set configuration permissions. The configuration should exist in the methods repository. Args: namespace (str): Configuration namespace config (str): Configuration name snapshot_id (int): snapshot_id ...
Set configuration permissions. The configuration should exist in the methods repository. Args: namespace (str): Configuration namespace config (str): Configuration name snapshot_id (int): snapshot_id of the method acl_updates (list(dict)): List of access control updates Sw...
entailment
def create_submission(wnamespace, workspace, cnamespace, config, entity, etype, expression=None, use_callcache=True): """Submit job in FireCloud workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): M...
Submit job in FireCloud workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name cnamespace (str): Method configuration namespace config (str): Method configuration name entity (str): Entity to submit job on. Should be the same typ...
entailment
def abort_submission(namespace, workspace, submission_id): """Abort running job in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier Swagger: https://api.firecloud.org/#...
Abort running job in a workspace. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier Swagger: https://api.firecloud.org/#!/Submissions/deleteSubmission
entailment
def get_submission(namespace, workspace, submission_id): """Request submission information. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier Swagger: https://api.firecloud.org/#!/Su...
Request submission information. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier Swagger: https://api.firecloud.org/#!/Submissions/monitorSubmission
entailment
def get_workflow_metadata(namespace, workspace, submission_id, workflow_id): """Request the metadata for a workflow in a submission. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier work...
Request the metadata for a workflow in a submission. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier workflow_id (str): Workflow's unique identifier. Swagger: https://api.firec...
entailment
def get_workflow_outputs(namespace, workspace, submission_id, workflow_id): """Request the outputs for a workflow in a submission. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier workfl...
Request the outputs for a workflow in a submission. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name submission_id (str): Submission's unique identifier workflow_id (str): Workflow's unique identifier. Swagger: https://api.firecl...
entailment
def create_workspace(namespace, name, authorizationDomain="", attributes=None): """Create a new FireCloud Workspace. Args: namespace (str): project to which workspace belongs name (str): Workspace name protected (bool): If True, this workspace is protected by dbGaP credentia...
Create a new FireCloud Workspace. Args: namespace (str): project to which workspace belongs name (str): Workspace name protected (bool): If True, this workspace is protected by dbGaP credentials. This option is only available if your FireCloud account is linked to yo...
entailment
def update_workspace_acl(namespace, workspace, acl_updates, invite_users_not_found=False): """Update workspace access control list. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name acl_updates (list(dict)): Acl updates as dicts with two keys: ...
Update workspace access control list. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name acl_updates (list(dict)): Acl updates as dicts with two keys: "email" - Firecloud user email "accessLevel" - one of "OWNER", "READER", "WRI...
entailment
def clone_workspace(from_namespace, from_workspace, to_namespace, to_workspace, authorizationDomain=""): """Clone a FireCloud workspace. A clone is a shallow copy of a FireCloud workspace, enabling easy sharing of data, such as TCGA data, without duplication. Args: from_nam...
Clone a FireCloud workspace. A clone is a shallow copy of a FireCloud workspace, enabling easy sharing of data, such as TCGA data, without duplication. Args: from_namespace (str): project (namespace) to which source workspace belongs from_workspace (str): Source workspace's name t...
entailment
def update_workspace_attributes(namespace, workspace, attrs): """Update or remove workspace attributes. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name attrs (list(dict)): List of update operations for workspace attributes. Use the h...
Update or remove workspace attributes. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name attrs (list(dict)): List of update operations for workspace attributes. Use the helper dictionary construction functions to create these: ...
entailment
def add_user_to_group(group, role, email): """Add a user to a group the caller owns Args: group (str): Group name role (str) : Role of user for group; either 'member' or 'admin' email (str): Email of user or group to add Swagger: https://api.firecloud.org/#!/Groups/addU...
Add a user to a group the caller owns Args: group (str): Group name role (str) : Role of user for group; either 'member' or 'admin' email (str): Email of user or group to add Swagger: https://api.firecloud.org/#!/Groups/addUserToGroup
entailment
def remove_user_from_group(group, role, email): """Remove a user from a group the caller owns Args: group (str): Group name role (str) : Role of user for group; either 'member' or 'admin' email (str): Email of user or group to remove Swagger: https://api.firecloud.org/#...
Remove a user from a group the caller owns Args: group (str): Group name role (str) : Role of user for group; either 'member' or 'admin' email (str): Email of user or group to remove Swagger: https://api.firecloud.org/#!/Groups/removeUserFromGroup
entailment
def register_commands(self, subparsers): """ Add commands to a list of subparsers. This will be called by Fissfc to add additional command targets from this plugin. Each command added should follow the pattern: parser = subparsers.add_parser('cmd', ...) parser.add_argum...
Add commands to a list of subparsers. This will be called by Fissfc to add additional command targets from this plugin. Each command added should follow the pattern: parser = subparsers.add_parser('cmd', ...) parser.add_argument(...) ... parser.set_defaults(func=do_my_c...
entailment
def new(namespace, name, wdl, synopsis, documentation=None, api_url=fapi.PROD_API_ROOT): """Create new FireCloud method. If the namespace + name already exists, a new snapshot is created. Args: namespace (str): Method namespace for this method name (str): Me...
Create new FireCloud method. If the namespace + name already exists, a new snapshot is created. Args: namespace (str): Method namespace for this method name (str): Method name wdl (file): WDL description synopsis (str): Short description of task ...
entailment
def template(self): """Return a method template for this method.""" r = fapi.get_config_template(self.namespace, self.name, self.snapshot_id, self.api_url) fapi._check_response_code(r, 200) return r.json()
Return a method template for this method.
entailment
def inputs_outputs(self): """Get information on method inputs & outputs.""" r = fapi.get_inputs_outputs(self.namespace, self.name, self.snapshot_id, self.api_url) fapi._check_response_code(r, 200) return r.json()
Get information on method inputs & outputs.
entailment
def acl(self): """Get the access control list for this method.""" r = fapi.get_repository_method_acl( self.namespace, self.name, self.snapshot_id, self.api_url) fapi._check_response_code(r, 200) return r.json()
Get the access control list for this method.
entailment
def set_acl(self, role, users): """Set permissions for this method. Args: role (str): Access level one of {one of "OWNER", "READER", "WRITER", "NO ACCESS"} users (list(str)): List of users to give role to """ acl_updates = [{"user": user, "role": ...
Set permissions for this method. Args: role (str): Access level one of {one of "OWNER", "READER", "WRITER", "NO ACCESS"} users (list(str)): List of users to give role to
entailment
def __ensure_gcloud(): """The *NIX installer is not guaranteed to add the google cloud sdk to the user's PATH (the Windows installer does). This ensures that if the default directory for the executables exists, it is added to the PATH for the duration of this package's use.""" if which('gcloud') is ...
The *NIX installer is not guaranteed to add the google cloud sdk to the user's PATH (the Windows installer does). This ensures that if the default directory for the executables exists, it is added to the PATH for the duration of this package's use.
entailment
def config_parse(files=None, config=None, config_profile=".fissconfig", **kwargs): ''' Read initial configuration state, from named config files; store this state within a config dictionary (which may be nested) whose keys may also be referenced as attributes (safely, defaulting to None if unset). A ...
Read initial configuration state, from named config files; store this state within a config dictionary (which may be nested) whose keys may also be referenced as attributes (safely, defaulting to None if unset). A config object may be passed in, as a way of accumulating or overwriting configuration sta...
entailment
def new(namespace, name, protected=False, attributes=dict(), api_url=fapi.PROD_API_ROOT): """Create a new FireCloud workspace. Returns: Workspace: A new FireCloud workspace Raises: FireCloudServerError: API call failed. """ r = fapi.create_wo...
Create a new FireCloud workspace. Returns: Workspace: A new FireCloud workspace Raises: FireCloudServerError: API call failed.
entailment
def refresh(self): """Reload workspace metadata from firecloud. Workspace metadata is cached in the data attribute of a Workspace, and may become stale, requiring a refresh(). """ r = fapi.get_workspace(self.namespace, self.name, self.api_url) fapi._check_response_code(r...
Reload workspace metadata from firecloud. Workspace metadata is cached in the data attribute of a Workspace, and may become stale, requiring a refresh().
entailment
def delete(self): """Delete the workspace from FireCloud. Note: This action cannot be undone. Be careful! """ r = fapi.delete_workspace(self.namespace, self.name) fapi._check_response_code(r, 202)
Delete the workspace from FireCloud. Note: This action cannot be undone. Be careful!
entailment
def lock(self): """Lock this Workspace. This causes the workspace to behave in a read-only way, regardless of access permissions. """ r = fapi.lock_workspace(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 204) self.data['workspace']['isLock...
Lock this Workspace. This causes the workspace to behave in a read-only way, regardless of access permissions.
entailment
def unlock(self): """Unlock this Workspace.""" r = fapi.unlock_workspace(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 204) self.data['workspace']['isLocked'] = False return self
Unlock this Workspace.
entailment
def update_attribute(self, attr, value): """Set the value of a workspace attribute.""" update = [fapi._attr_up(attr, value)] r = fapi.update_workspace_attributes(self.namespace, self.name, update, self.api_url) fapi._check_response_code(r, 200...
Set the value of a workspace attribute.
entailment
def remove_attribute(self, attr): """Remove attribute from a workspace. Args: attr (str): attribute name """ update = [fapi._attr_rem(attr)] r = fapi.update_workspace_attributes(self.namespace, self.name, update, self.a...
Remove attribute from a workspace. Args: attr (str): attribute name
entailment
def import_tsv(self, tsv_file): """Upload entity data to workspace from tsv loadfile. Args: tsv_file (file): Tab-delimited file of entity data """ r = fapi.upload_entities_tsv(self.namespace, self.name, self.tsv_file, self.api_url) ...
Upload entity data to workspace from tsv loadfile. Args: tsv_file (file): Tab-delimited file of entity data
entailment
def get_entity(self, etype, entity_id): """Return entity in this workspace. Args: etype (str): Entity type entity_id (str): Entity name/unique id """ r = fapi.get_entity(self.namespace, self.name, etype, entity_id, self.api_url) ...
Return entity in this workspace. Args: etype (str): Entity type entity_id (str): Entity name/unique id
entailment
def delete_entity(self, etype, entity_id): """Delete an entity in this workspace. Args: etype (str): Entity type entity_id (str): Entity name/unique id """ r = fapi.delete_entity(self.namespace, self.name, etype, entity_id, self....
Delete an entity in this workspace. Args: etype (str): Entity type entity_id (str): Entity name/unique id
entailment
def import_entities(self, entities): """Upload entity objects. Args: entities: iterable of firecloud.Entity objects. """ edata = Entity.create_payload(entities) r = fapi.upload_entities(self.namespace, self.name, edata, self.api_url) ...
Upload entity objects. Args: entities: iterable of firecloud.Entity objects.
entailment
def create_set(self, set_id, etype, entities): """Create a set of entities and upload to FireCloud. Args etype (str): one of {"sample, "pair", "participant"} entities: iterable of firecloud.Entity objects. """ if etype not in {"sample", "pair", "participant"}: ...
Create a set of entities and upload to FireCloud. Args etype (str): one of {"sample, "pair", "participant"} entities: iterable of firecloud.Entity objects.
entailment
def submissions(self): """List job submissions in workspace.""" r = fapi.get_submissions(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 200) return r.json()
List job submissions in workspace.
entailment
def entity_types(self): """List entity types in workspace.""" r = fapi.get_entity_types(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 200) return r.json().keys()
List entity types in workspace.
entailment
def entities(self): """List all entities in workspace.""" r = fapi.get_entities_with_type(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 200) edicts = r.json() return [Entity(e['entityType'], e['name'], e['attributes'...
List all entities in workspace.
entailment
def __get_entities(self, etype): """Helper to get entities for a given type.""" r = fapi.get_entities(self.namespace, self.name, etype, self.api_url) fapi._check_response_code(r, 200) return [Entity(e['entityType'], e['name'], e['attributes']) ...
Helper to get entities for a given type.
entailment
def copy_entities(self, from_namespace, from_workspace, etype, enames): """Copy entities from another workspace. Args: from_namespace (str): Source workspace namespace from_workspace (str): Source workspace name etype (str): Entity type enames (list(str))...
Copy entities from another workspace. Args: from_namespace (str): Source workspace namespace from_workspace (str): Source workspace name etype (str): Entity type enames (list(str)): List of entity names to copy
entailment
def configs(self): """Get method configurations in a workspace.""" raise NotImplementedError r = fapi.get_configs(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 200) cdata = r.json() configs = [] for c in cdata: cnamespace = c['n...
Get method configurations in a workspace.
entailment
def acl(self): """Get the access control list for this workspace.""" r = fapi.get_workspace_acl(self.namespace, self.name, self.api_url) fapi._check_response_code(r, 200) return r.json()
Get the access control list for this workspace.
entailment
def clone(self, to_namespace, to_name): """Clone this workspace. Args: to_namespace (str): Target workspace namespace to_name (str): Target workspace name """ r = fapi.clone_workspace(self.namespace, self.name, to_namespace, to_na...
Clone this workspace. Args: to_namespace (str): Target workspace namespace to_name (str): Target workspace name
entailment
def supervise(project, workspace, namespace, workflow, sample_sets, recovery_file): """ Supervise submission of jobs from a Firehose-style workflow of workflows""" # Get arguments logging.info("Initializing FireCloud Supervisor...") logging.info("Saving recovery checkpoints to " + recover...
Supervise submission of jobs from a Firehose-style workflow of workflows
entailment
def init_supervisor_data(dotfile, sample_sets): """ Parse a workflow description written in DOT (like Firehose)""" with open(dotfile) as wf: graph_data = wf.read() graph = pydot.graph_from_dot_data(graph_data)[0] nodes = [n.get_name().strip('"') for n in graph.get_nodes()] monitor_data = d...
Parse a workflow description written in DOT (like Firehose)
entailment
def validate_monitor_tasks(dependencies, args): """ Validate that all entries in the supervisor are valid task configurations and that all permissions requirements are satisfied. """ # Make a list of all task configurations needed to supervise sup_configs = sorted(dependencies.keys()) try:...
Validate that all entries in the supervisor are valid task configurations and that all permissions requirements are satisfied.
entailment
def recover_and_supervise(recovery_file): """ Retrieve monitor data from recovery_file and resume monitoring """ try: logging.info("Attempting to recover Supervisor data from " + recovery_file) with open(recovery_file) as rf: recovery_data = json.load(rf) monitor_data = r...
Retrieve monitor data from recovery_file and resume monitoring
entailment
def supervise_until_complete(monitor_data, dependencies, args, recovery_file): """ Supervisor loop. Loop forever until all tasks are evaluated or completed """ project = args['project'] workspace = args['workspace'] namespace = args['namespace'] sample_sets = args['sample_sets'] recovery_data = ...
Supervisor loop. Loop forever until all tasks are evaluated or completed
entailment
def space_list(args): ''' List accessible workspaces, in TSV form: <namespace><TAB>workspace''' r = fapi.list_workspaces() fapi._check_response_code(r, 200) spaces = [] project = args.project if project: project = re.compile('^' + project) for space in r.json(): ns = space...
List accessible workspaces, in TSV form: <namespace><TAB>workspace
entailment
def space_exists(args): """ Determine if the named space exists in the given project (namespace)""" # The return value is the INVERSE of UNIX exit status semantics, (where # 0 = good/true, 1 = bad/false), so to check existence in UNIX one would do # if ! fissfc space_exists blah ; then # ... ...
Determine if the named space exists in the given project (namespace)
entailment
def space_lock(args): """ Lock a workspace """ r = fapi.lock_workspace(args.project, args.workspace) fapi._check_response_code(r, 204) if fcconfig.verbosity: eprint('Locked workspace {0}/{1}'.format(args.project, args.workspace)) return 0
Lock a workspace
entailment
def space_unlock(args): """ Unlock a workspace """ r = fapi.unlock_workspace(args.project, args.workspace) fapi._check_response_code(r, 204) if fcconfig.verbosity: eprint('Unlocked workspace {0}/{1}'.format(args.project,args.workspace)) return 0
Unlock a workspace
entailment
def space_new(args): """ Create a new workspace. """ r = fapi.create_workspace(args.project, args.workspace, args.authdomain, dict()) fapi._check_response_code(r, 201) if fcconfig.verbosity: eprint(r.content) return 0
Create a new workspace.
entailment
def space_info(args): """ Get metadata for a workspace. """ r = fapi.get_workspace(args.project, args.workspace) fapi._check_response_code(r, 200) return r.text
Get metadata for a workspace.
entailment
def space_delete(args): """ Delete a workspace. """ message = "WARNING: this will delete workspace: \n\t{0}/{1}".format( args.project, args.workspace) if not args.yes and not _confirm_prompt(message): return 0 r = fapi.delete_workspace(args.project, args.workspace) fapi._check_respo...
Delete a workspace.
entailment
def space_clone(args): """ Replicate a workspace """ # FIXME: add --deep copy option (shallow by default) # add aliasing capability, then make space_copy alias if not args.to_workspace: args.to_workspace = args.workspace if not args.to_project: args.to_project = args.project ...
Replicate a workspace
entailment
def space_acl(args): ''' Retrieve access control list for a workspace''' r = fapi.get_workspace_acl(args.project, args.workspace) fapi._check_response_code(r, 200) result = dict() for user, info in sorted(r.json()['acl'].items()): result[user] = info['accessLevel'] return result
Retrieve access control list for a workspace
entailment
def space_set_acl(args): """ Assign an ACL role to list of users for a workspace """ acl_updates = [{"email": user, "accessLevel": args.role} for user in args.users] r = fapi.update_workspace_acl(args.project, args.workspace, acl_updates) fapi._check_response_code(r, 200) errors =...
Assign an ACL role to list of users for a workspace
entailment
def space_search(args): """ Search for workspaces matching certain criteria """ r = fapi.list_workspaces() fapi._check_response_code(r, 200) # Parse the JSON for workspace + namespace; then filter by # search terms: each term is treated as a regular expression workspaces = r.json() extra_te...
Search for workspaces matching certain criteria
entailment
def entity_import(args): """ Upload an entity loadfile. """ project = args.project workspace = args.workspace chunk_size = args.chunk_size with open(args.tsvfile) as tsvf: headerline = tsvf.readline().strip() entity_data = [l.rstrip('\n') for l in tsvf] return _batch_load(proje...
Upload an entity loadfile.
entailment
def set_export(args): '''Return a list of lines in TSV form that would suffice to reconstitute a container (set) entity, if passed to entity_import. The first line in the list is the header, and subsequent lines are the container members. ''' r = fapi.get_entity(args.project, args.workspace,...
Return a list of lines in TSV form that would suffice to reconstitute a container (set) entity, if passed to entity_import. The first line in the list is the header, and subsequent lines are the container members.
entailment
def entity_types(args): """ List entity types in a workspace """ r = fapi.list_entity_types(args.project, args.workspace) fapi._check_response_code(r, 200) return r.json().keys()
List entity types in a workspace
entailment
def entity_list(args): """ List entities in a workspace. """ r = fapi.get_entities_with_type(args.project, args.workspace) fapi._check_response_code(r, 200) return [ '{0}\t{1}'.format(e['entityType'], e['name']) for e in r.json() ]
List entities in a workspace.
entailment
def participant_list(args): ''' List participants within a container''' # Case 1: retrieve participants within a named data entity if args.entity_type and args.entity: # Edge case: caller asked for participant within participant (itself) if args.entity_type == 'participant': ret...
List participants within a container
entailment
def pair_list(args): ''' List pairs within a container. ''' # Case 1: retrieve pairs within a named data entity if args.entity_type and args.entity: # Edge case: caller asked for pair within a pair (itself) if args.entity_type == 'pair': return [ args.entity.strip() ] # ...
List pairs within a container.
entailment
def sample_list(args): ''' List samples within a container. ''' # Case 1: retrieve samples within a named data entity if args.entity_type and args.entity: # Edge case: caller asked for samples within a sample (itself) if args.entity_type == 'sample': return [ args.entity.strip()...
List samples within a container.
entailment