common-workflow-language / common-workflow-language/cwltool

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

未关闭
#3 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
376
派生
255
平均合并
2 天 7 小时
30 天内合并 PR
12

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。