Exemple #1
0
def get_file_dependencies_obj(cwl_obj, basedir):
    """Return a dictionary which contains the CWL workflow file dependencies.

    :param cwl_obj: A CWL tool or job which might contain file dependencies.
    :param basedir: Workflow base dir.
    :returns: A dictionary composed of valid CWL file dependencies.
    """
    # Load the document
    # remove filename additions (e.g. 'v1.0/conflict-wf.cwl#collision')
    document = cwl_obj.split("#")[0]
    document_loader, workflow_obj, uri = fetch_document(document)
    in_memory_buffer = io.StringIO()
    # Get dependencies
    printdeps(
        workflow_obj,
        document_loader.loader,
        in_memory_buffer,
        "primary",
        uri,
        basedir=basedir,
    )
    file_dependencies_obj = yaml.load(in_memory_buffer.getvalue(),
                                      Loader=yaml.FullLoader)
    in_memory_buffer.close()
    return file_dependencies_obj
Exemple #2
0
def get_file_dependencies_obj(cwl_obj, basedir):
    """Return a dictionary which contains the CWL workflow file dependencies.

    :param cwl_obj: A CWL tool or job which might contain file dependencies.
    :param basedir: Workflow base dir.
    :returns: A dictionary composed of valid CWL file dependencies.
    """
    # Load de document
    loading_context = LoadingContext()
    document_loader, workflow_obj, uri = fetch_document(
        cwl_obj,
        resolver=loading_context.resolver,
        fetcher_constructor=loading_context.fetcher_constructor,
    )
    in_memory_buffer = io.StringIO() if PY3 else io.BytesIO()
    # Get dependencies
    printdeps(workflow_obj,
              document_loader,
              in_memory_buffer,
              "primary",
              uri,
              basedir=basedir)
    file_dependencies_obj = yaml.load(in_memory_buffer.getvalue(),
                                      Loader=yaml.FullLoader)
    in_memory_buffer.close()
    return file_dependencies_obj