Skip to content

Commit 4d1f21c

Browse files
committed
we already have the key, use it
1 parent b6ad12b commit 4d1f21c

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

cwltool/job.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def add_volumes(self,
515515
"""Append volume mappings to the runtime option list."""
516516

517517
container_outdir = self.builder.outdir
518-
for vol in (itm[1] for itm in pathmapper.items() if itm[1].staged):
518+
for key, vol in (itm for itm in pathmapper.items() if itm[1].staged):
519519
host_outdir_tgt = None # type: Optional[Text]
520520
if vol.target.startswith(container_outdir + "/"):
521521
host_outdir_tgt = os.path.join(
@@ -536,10 +536,8 @@ def add_volumes(self,
536536
elif vol.type in ["CreateFile", "CreateWritableFile"]:
537537
new_path = self.create_file_and_add_volume(
538538
runtime, vol, host_outdir_tgt, secret_store)
539-
key = pathmapper.reversemap(vol.target)
540-
if key:
541-
pathmapper.update(
542-
key[0], new_path, vol.target, vol.type, vol.staged)
539+
pathmapper.update(
540+
key, new_path, vol.target, vol.type, vol.staged)
543541

544542
def run(self, runtimeContext): # type: (RuntimeContext) -> None
545543
if not os.path.exists(self.tmpdir):

cwltool/process.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def stage_files(pathmapper, # type: PathMapper
233233
secret_store=None # type: SecretStore
234234
): # type: (...) -> None
235235
"""Link or copy files to their targets. Create them as needed."""
236-
for _, entry in pathmapper.items():
236+
for key, entry in pathmapper.items():
237237
if not entry.staged:
238238
continue
239239
if not os.path.exists(os.path.dirname(entry.target)):
@@ -275,11 +275,8 @@ def stage_files(pathmapper, # type: PathMapper
275275
os.chmod(entry.target, stat.S_IRUSR) # Read only
276276
else: # it is a "CreateWritableFile"
277277
ensure_writable(entry.target)
278-
key = pathmapper.reversemap(entry.target)
279-
if key:
280-
pathmapper.update(
281-
key[0],
282-
entry.target, entry.target, entry.type, entry.staged)
278+
pathmapper.update(
279+
key, entry.target, entry.target, entry.type, entry.staged)
283280

284281

285282
def relocateOutputs(outputObj, # type: Union[Dict[Text, Any],List[Dict[Text, Any]]]

0 commit comments

Comments
 (0)