Skip to content

Commit 70dafe0

Browse files
authored
Merge pull request #1384 from common-workflow-language/no-useless-dirs
No useless dirs
2 parents 3d026bb + 2e6ba5d commit 70dafe0

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

cwltool/command_line_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ def collect_output(
12141214
rfile = files.copy()
12151215
revmap(rfile)
12161216
if files["class"] == "Directory":
1217-
ll = schema.get("loadListing") or builder.loadListing
1217+
ll = binding.get("loadListing") or builder.loadListing
12181218
if ll and ll != "no_listing":
12191219
get_listing(fs_access, files, (ll == "deep_listing"))
12201220
else:

cwltool/job.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def _execute(
379379
stderr_path=stderr_path,
380380
env=env,
381381
cwd=self.outdir,
382-
job_dir=runtimeContext.create_outdir(),
382+
make_job_dir=lambda: runtimeContext.create_outdir(),
383383
job_script_contents=job_script_contents,
384384
timelimit=self.timelimit,
385385
name=self.name,
@@ -909,7 +909,7 @@ def _job_popen(
909909
stderr_path: Optional[str],
910910
env: MutableMapping[str, str],
911911
cwd: str,
912-
job_dir: str,
912+
make_job_dir: Callable[[], str],
913913
job_script_contents: Optional[str] = None,
914914
timelimit: Optional[int] = None,
915915
name: Optional[str] = None,
@@ -1004,11 +1004,12 @@ def terminate(): # type: () -> None
10041004
"stdin_path": stdin_path,
10051005
}
10061006

1007-
with open(
1008-
os.path.join(job_dir, "job.json"), mode="w", encoding="utf-8"
1009-
) as job_file:
1010-
json_dump(job_description, job_file, ensure_ascii=False)
1007+
job_dir = make_job_dir()
10111008
try:
1009+
with open(
1010+
os.path.join(job_dir, "job.json"), mode="w", encoding="utf-8"
1011+
) as job_file:
1012+
json_dump(job_description, job_file, ensure_ascii=False)
10121013
job_script = os.path.join(job_dir, "run_job.bash")
10131014
with open(job_script, "wb") as _:
10141015
_.write(job_script_contents.encode("utf-8"))

cwltool/process.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ def inc(d): # type: (List[int]) -> None
824824

825825
files = [] # type: List[CWLObjectType]
826826
bindings = CommentedSeq()
827+
outdir = ""
827828
tmpdir = ""
828829
stagedir = ""
829830

@@ -852,8 +853,8 @@ def inc(d): # type: (List[int]) -> None
852853
tmpdir = runtime_context.docker_tmpdir or "/tmp" # nosec
853854
stagedir = runtime_context.docker_stagedir or "/var/lib/cwl"
854855
else:
855-
outdir = fs_access.realpath(runtime_context.get_outdir())
856-
if self.tool["class"] != "Workflow":
856+
if self.tool["class"] == "CommandLineTool":
857+
outdir = fs_access.realpath(runtime_context.get_outdir())
857858
tmpdir = fs_access.realpath(runtime_context.get_tmpdir())
858859
stagedir = fs_access.realpath(runtime_context.get_stagedir())
859860

0 commit comments

Comments
 (0)