def call_api(url): """ Use the firecloud api module to query firecloud Allows for additional options not included in fiss api""" result = api.__get(url) try: api._check_response_code(result, 200) result = result.json() except errors.FireCloudServerError as e: print("Error with api query ") print(e) result = {} return result
def export_workspace_attributes_TSV(namespace, workspace): """Export workspace attributes. Args: namespace (str): project to which workspace belongs workspace (str): Workspace name Swagger: https://api.firecloud.org/#!/Workspaces/exportAttributesTSV """ uri = "workspaces/{0}/{1}/exportAttributesTSV".format(namespace, workspace) return fapi.__get(uri)
def get_proxy_account(user_acct=None): if user_acct is None: user_acct = get_application_default_account() email = cache_fetch('proxy-acct', user_acct) if email is not None: return email acct = proxy_group_for_user(user_acct) response = fc.__get('/api/groups/{}'.format(acct)) if response.status_code == 200: email = response.json()['groupEmail'] if email == acct + '@firecloud.org': cache_write(email, 'proxy-acct', user_acct) return email
def get_workflow_metadata_gz(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 workflow_id (str): Workflow's unique identifier. Swagger: https://api.firecloud.org/#!/Submissions/workflowMetadata """ uri = "workspaces/{0}/{1}/submissions/{2}/workflows/{3}".format(namespace, workspace, submission_id, workflow_id) headers = copy.deepcopy(fapi._fiss_agent_header()) headers.update({'Accept-Encoding': 'gzip', 'User-Agent': 'gzip'}) return fapi.__get(uri, headers=headers)
def get_workflow_metadata_withExclude(namespace, workspace, submission_id, workflow_id, *keysToExclude): """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. *keysToExclude (strs): any number of keys to EXCLUDE, to restrict values returned Swagger: https://api.firecloud.org/#!/Submissions/workflowMetadata """ excludeKeyStr = '&'.join(['excludeKey='+item for item in keysToExclude]) uri = "workspaces/{0}/{1}/submissions/{2}/workflows/{3}?{4}&expandSubWorkflows=false".format(namespace,workspace, submission_id, workflow_id, excludeKeyStr) return fapi.__get(uri)