示例#1
0
    def _load_workflow_def(self):

        # load geneflow definition file
        gf_def = Definition()
        if not gf_def.load(str(self._workflow_yaml)):
            Log.an().error('invalid geneflow definition: %s', self._workflow_yaml)
            return False

        # make sure there is a workflow definition in the file
        if not gf_def.workflows():
            Log.an().error('no workflows in geneflow definition')
            return False

        # extract the workflow definition
        self._workflow = next(iter(gf_def.workflows().values()))

        return True
示例#2
0
文件: help.py 项目: CDCgov/geneflow2
def help_func(args, other_args, subparser=None):
    """
    GeneFlow workflow help.

    Args:
        args.workflow: workflow definition or package directory.

    Returns:
        On success: True.
        On failure: False.

    """
    # get absolute path to workflow
    workflow_yaml = resolve_workflow_path(args.workflow)
    if workflow_yaml:
        Log.some().info('workflow definition found: %s', workflow_yaml)
    else:
        Log.an().error('cannot find workflow definition: %s', args.workflow)
        return False

    # load workflow
    gf_def = Definition()
    if not gf_def.load(workflow_yaml):
        Log.an().error('workflow definition load failed: %s', workflow_yaml)
        return False

    # get first workflow dict
    workflow_dict = next(iter(gf_def.workflows().values()))
    print()
    print('{}: {}'.format(workflow_dict['name'], workflow_dict['description']))
    print()
    print('Execution Command:')
    print('\tgf [--log-level LOG_LEVEL] [--log-file LOG_FILE] run WORKFLOW_PATH')
    print('\t\t-o OUTPUT [-n NAME] [INPUTS] [PARAMETERS] [-w WORK_DIR [WORK_DIR ...]]')
    print('\t\t[--ec CONTEXT [CONTEXT ...]] [--em METHOD [METHOD ...]] [--ep PARAM [PARAM ...]]')
    print()
    print('\tWORKFLOW_PATH: Path to directory that contains workflow definition')
    print()
    print('Job Configuration:')
    print('\t-o,--output: Output directory')
    print('\t-n,--name: Job name, a directory with this name will be created in the output directory')
    print('\t\tdefault: geneflow-job')
    print('\t-w,--work: Work directories, for temporary or intermediate data')
    print('\t\tdefault: ~/.geneflow/work')
    print('\t--no-output-hash: Flag indicating that the output directory should NOT include a random hash')
    print('\t\tdefault: not set, output will include random hash')
    print()
    print('Inputs: Workflow-Specific Files or Folders')
    for input_key in workflow_dict['inputs']:
        print(
            '\t--in.{}: {}: {}'.format(
                input_key,
                workflow_dict['inputs'][input_key]['label'],
                workflow_dict['inputs'][input_key]['description']
            )
        )
        print(
            '\t\ttype: {}, default: {}'.format(
                workflow_dict['inputs'][input_key]['type'],
                workflow_dict['inputs'][input_key]['default']
            )
        )
    print()
    print('Parameters: Workflow-Specific Values')
    for param_key in workflow_dict['parameters']:
        print(
            '\t--param.{}: {}: {}'.format(
                param_key,
                workflow_dict['parameters'][param_key]['label'],
                workflow_dict['parameters'][param_key]['description']
            )
        )
        print(
            '\t\ttype: {}, default: {}'.format(
                workflow_dict['parameters'][param_key]['type'],
                workflow_dict['parameters'][param_key]['default']
            )
        )
    print()
    print('Execution Configuration:')
    print('\t--ec,--exec-context: Execution contexts, e.g., local, agave, gridengine.')
    print('\t\tThese can be specified for all workflow steps with "default:[CONTEXT]"')
    print('\t\tor for specific steps with "step-name:[CONTEXT]".')
    print('\t--em,--exec-method: Exeuction methods, e.g., singularity, docker, environment.')
    print('\t\tThese can be specified for all workflow steps with "default:[METHOD]"')
    print('\t\tor for specific steps with "step-name:[METHOD]". By default each app associated')
    print('\t\twith a workflow step tries to automatically detect the execution method.')
    print('\t--ep,--exec-param: Execution parameters, e.g., slots, mem, or other.')
    print('\t\tThese can be specified for all workflow steps with "default.slots:[VALUE]"')
    print('\t\tor for specific steps with "step-name.slots:[VALUE]". Execution parameters')
    print('\t\tdepend on the execution context.')

    return True
示例#3
0
文件: help.py 项目: reagank/geneflow
def help_func(args):
    """
    GeneFlow workflow help.

    Args:
        args.workflow: workflow definition or package directory.

    Returns:
        On success: True.
        On failure: False.

    """
    # get absolute path to workflow
    workflow_yaml = resolve_workflow_path(args.workflow)
    if workflow_yaml:
        Log.some().info('workflow definition found: %s', workflow_yaml)
    else:
        Log.an().error('cannot find workflow definition: %s', args.workflow)
        return False

    # load workflow
    gf_def = Definition()
    if not gf_def.load(workflow_yaml):
        Log.an().error('workflow definition load failed: %s', workflow_yaml)
        return False

    # get first workflow dict
    workflow_dict = next(iter(gf_def.workflows().values()))
    print()
    print('GeneFlow: {}'.format(workflow_dict['name']))
    print()
    print('{}'.format(workflow_dict['description']))
    print()
    print('Inputs:')
    for input_key in workflow_dict['inputs']:
        print(
            '\t--{}: {}: {}'.format(
                input_key,
                workflow_dict['inputs'][input_key]['label'],
                workflow_dict['inputs'][input_key]['description']
            )
        )
        print(
            '\t\ttype: {}, default: {}'.format(
                workflow_dict['inputs'][input_key]['type'],
                workflow_dict['inputs'][input_key]['default']
            )
        )
    print()
    print('Parameters:')
    for param_key in workflow_dict['parameters']:
        print(
            '\t--{}: {}: {}'.format(
                param_key,
                workflow_dict['parameters'][param_key]['label'],
                workflow_dict['parameters'][param_key]['description']
            )
        )
        print(
            '\t\ttype: {}, default: {}'.format(
                workflow_dict['parameters'][param_key]['type'],
                workflow_dict['parameters'][param_key]['default']
            )
        )

    return True