コード例 #1
0
ファイル: cli.py プロジェクト: hall-lab/cromulent
def abort(workflow_id, host, port):
    server = cromwell.Server(host, port)
    if not server.is_accessible():
        msg = "Could not access the cromwell server!  Please ensure it is up!"
        raise Exception(msg)
    status = server.abort_workflow(workflow_id)
    print(json.dumps(status, indent=4, sort_keys=True))
コード例 #2
0
ファイル: cli.py プロジェクト: hall-lab/cromulent
def execution_status(workflow_id, host, port):
    server = cromwell.Server(host, port)
    if not server.is_accessible():
        msg = "Could not access the cromwell server!  Please ensure it is up!"
        raise Exception(msg)
    status_summary = server.get_workflow_execution_status(workflow_id)
    creport.display_workflow_execution_status(workflow_id, status_summary)
コード例 #3
0
ファイル: cli.py プロジェクト: hall-lab/cromulent
def outputs(workflow_id, host, port):
    server = cromwell.Server(host, port)
    if not server.is_accessible():
        msg = "Could not access the cromwell server!  Please ensure it is up!"
        raise Exception(msg)
    metadata = server.get_workflow_input_outputs(workflow_id)
    pretty_metadata = json.dumps(metadata, indent=4, sort_keys=True)
    print(pretty_metadata)
コード例 #4
0
ファイル: cli.py プロジェクト: hall-lab/cromulent
def metadata_lite(workflow_id, output, host, port):
    cromwell.Server.get_workflow_metadata_lite = \
        utils.memoize(cromwell.Server.get_workflow_metadata_lite)
    server = cromwell.Server(host, port)
    if not server.is_accessible():
        msg = "Could not access the cromwell server!  Please ensure it is up!"
        raise Exception(msg)
    metadata = server.get_workflow_metadata_lite(workflow_id)
    pretty_metadata = json.dumps(metadata, indent=4, sort_keys=True)
    if output:
        with open(output, 'w') as f:
            print(pretty_metadata, file=f)
    else:
        print(pretty_metadata)
コード例 #5
0
ファイル: cli.py プロジェクト: hall-lab/cromulent
def _get_cromwell_server(host, port):
    # setup the server object
    # decorate the cromwell.Server class function
    cromwell.Server.get_workflow_metadata = \
        utils.memoize(cromwell.Server.get_workflow_metadata)
    server = cromwell.Server(host, port)

    logging.info("Checking if we have access to the cromwell server")
    if not server.is_accessible():
        msg = "Could not access the cromwell server!  Please ensure it is up!"
        logging.error(msg)
        raise Exception(msg)

    return server
コード例 #6
0
ファイル: cli.py プロジェクト: hall-lab/cromulent
def estimate_workflow_cost(metadata_path=None,
                           workflow_id=None,
                           sku_path=None,
                           host='localhost',
                           port=8000,
                           tier_scheme='all'):
    # setup the server object
    # decorate the cromwell.Server class function
    cromwell.Server.get_workflow_metadata = \
        utils.memoize(cromwell.Server.get_workflow_metadata)
    server = cromwell.Server(host, port)

    logging.info("Checking if we have access to the cromwell server")
    if not server.is_accessible():
        msg = "Could not access the cromwell server!  Please ensure it is up!"
        logging.error(msg)
        raise Exception(msg)

    # setup the google services and skus information
    gcloud.GoogleServices.get_available_compute_types = \
        utils.memoize(gcloud.GoogleServices.get_available_compute_types)
    google = gcloud.GoogleServices(sku_path)

    # derive the metadata
    metadata = None
    if metadata_path:
        msg = "Loading the workflow metadata from : {}".format(metadata_path)
        logging.info(msg)
        with open(metadata_path) as f:
            metadata = json.load(f)
    else:
        logging.info("Fetching metadata from cromwell")
        metadata = server.get_workflow_metadata(workflow_id)
        logging.info("Fetched metadata from cromwell")

    if metadata is None:
        msg = "Could not derive workflow metadata"
        logger.error(msg)
        raise Exception(msg)

    # perform the calculations
    estimator = cromwell.CostEstimator(server, google)
    logging.info("Starting cost calculations")
    cost = estimator.calculate_cost(metadata, tier_scheme)
    logging.info("Finished cost calculations")

    return cost
コード例 #7
0
 def test(self):
     server = cromwell.Server()
     self.assertEqual(server.host, 'localhost')
     self.assertEqual(server.port, 8000)
     self.__class__.server = server