def setUpClass(cls, msg=""): '''Set up FireCloud etc to run tests''' print("\nStarting low-level api tests ...\n", file=sys.stderr) fiss_verbosity = os.environ.get("FISS_TEST_VERBOSITY", None) if fiss_verbosity == None: fiss_verbosity = 0 fcconfig = fccore.config_parse() cls.project = fcconfig.project if not cls.project: raise ValueError("Your configuration must define a FireCloud project") fcconfig.set_verbosity(fiss_verbosity) # Set up a temp workspace for duration of tests; and in case a previous # test failed, attempt to unlock & delete before creating anew. Note # that bc we execute space create/delete here, their tests are NO-OPs cls.workspace = getuser() + '_FISS_TEST' r = fapi.unlock_workspace(cls.project, cls.workspace) r = fapi.delete_workspace(cls.project, cls.workspace) r = fapi.create_workspace(cls.project, cls.workspace) fapi._check_response_code(r, 201)
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Run before 04_v2_genotype_batch """ import argparse import os import firecloud.api as fapi from firecloud import fccore from google.cloud import storage fcconfig = fccore.config_parse() def get_bucket_name(namespace, workspace): response = fapi.get_workspace(namespace, workspace) fapi._check_response_code(response, 200) return response.json()['workspace']['bucketName'] def get_sample_sets(namespace, workspace, batches): response = fapi.get_entities(namespace, workspace, 'sample_set') fapi._check_response_code(response, 200) return [entity for entity in response.json() if entity['name'] in batches] def make_vcfs_list(namespace, workspace, batches): sample_sets = get_sample_sets(namespace, workspace, batches)