コード例 #1
0
ファイル: common.py プロジェクト: dmaccannell/geneflow
def run_workflow(job, config, log_level):
    """
    Run a GeneFlow workflow.

    Args:
        job: job dict describing run.
        config: GeneFlow configuration dict.
        log_level: logging level for this run.

    Returns:
        On success: Workflow job dict.
        On failure: False.

    """
    if job['log']:
        # reconfig log location for this run
        Log.config(log_level, job['log'])
    Log.some().info('job loaded: %s -> %s', job['name'], job['id'])

    # run job
    workflow = Workflow(job['id'], config)
    if not workflow.initialize():
        Log.an().error('workflow initialization failed: job_id=%s', job['id'])
        return False

    Log.some().info('running workflow:\n%s', str(workflow))

    if not workflow.run():
        Log.an().error('workflow run failed: job_id=%s', job['id'])
        return False

    Log.some().info('workflow complete:\n%s', str(workflow))

    return workflow.get_job()
コード例 #2
0
def main():
    """
    Geneflow CLI main entrypoint.

    Args:
        None.

    Returns:
        Nothing.

    """
    args, subparser = parse_args()
    if not args:
        sys.exit(1)

    # configure logging
    Log.config(args[0].log_level, args[0].log_file)

    # display GeneFlow version
    Log.some().info('GeneFlow %s', __version__)

    # call the appropriate command
    if not args[0].func(args=args[0], other_args=args[1], subparser=subparser):
        sys.exit(1)

    sys.exit(0)
コード例 #3
0
ファイル: __main__.py プロジェクト: reagank/geneflow
def main():
    """
    Geneflow CLI main entrypoint.

    Args:
        None.

    Returns:
        Nothing.

    """
    args = parse_args()
    if not args:
        sys.exit(1)

    # configure logging
    Log.config(args.log_level, args.log_file)

    # call the appropriate command
    if not args.func(args):
        sys.exit(1)

    sys.exit(0)