Skip to content

Exact definition of --tmp-outdir-prefix and --tmpdir-prefix is ambiguous #3

Open

Description

@schultzmattd

I've hit what I think is an inconsistency in the expectation of these two arguments. When the arguments for the cwl-runner are first parsed, there are a couple of checks to make sure that the paths provided in these two arguments refer to actual directories:

cwltool/main.py:350

    if args.tmp_outdir_prefix != 'tmp':
        # Use user defined temp directory (if it exists)
        args.tmp_outdir_prefix = os.path.abspath(args.tmp_outdir_prefix)
        if not os.path.exists(args.tmp_outdir_prefix):
            _logger.error("Intermediate output directory prefix doesn't exist, reverting to default")
            return 1

    if args.tmpdir_prefix != 'tmp':
        # Use user defined prefix (if the folder exists)
        args.tmpdir_prefix = os.path.abspath(args.tmpdir_prefix)
        if not os.path.exists(args.tmpdir_prefix):
            _logger.error("Temporary directory prefix doesn't exist.")
            return 1

However, when these arguments are actually used, they aren't required to be, and in fact, will be used like the prefixes to directories that are created during the CWL run:

draft2tool.py:137

        if dockerReq and kwargs.get("use_container"):
            out_prefix = kwargs.get("tmp_outdir_prefix")
            j.outdir = kwargs.get("outdir") or tempfile.mkdtemp(prefix=out_prefix)
            tmpdir_prefix = kwargs.get('tmpdir_prefix')
            j.tmpdir = kwargs.get("tmpdir") or tempfile.mkdtemp(prefix=tmpdir_prefix)
        else:
            j.outdir = builder.outdir
            j.tmpdir = builder.tmpdir

Is it possible to either clarify in the documentation exactly how these arguments are expected to be used, or reconcile the usage in the code? My two cents is to make the first code block check for that the basedir of the argument exists, and then using them as prefixes to which random strings will be appended.

Activity

  1. added a commit that references this issue on Dec 31, 2015
  2. added a commit that references this issue on Mar 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions