@@ -175,8 +175,14 @@ def _setup(self, kwargs): # type: (Dict) -> None
175
175
_logger .debug (u"[job %s] initial work dir %s" , self .name ,
176
176
json .dumps ({p : self .generatemapper .mapper (p ) for p in self .generatemapper .files ()}, indent = 4 ))
177
177
178
- def _execute (self , runtime , env , rm_tmpdir = True , move_outputs = "move" , secret_store = None ):
179
- # type: (List[Text], MutableMapping[Text, Text], bool, Text, SecretStore) -> None
178
+ def _execute (self ,
179
+ runtime , # type:List[Text]
180
+ env , # type: MutableMapping[Text, Text]
181
+ rm_tmpdir = True , # type: bool
182
+ move_outputs = "move" , # type: Text
183
+ secret_store = None , # type: SecretStore
184
+ tmp_outdir_prefix = None # type: Text
185
+ ): # type: (...) -> None
180
186
181
187
scr , _ = get_feature (self , "ShellCommandRequirement" )
182
188
@@ -228,14 +234,9 @@ def _execute(self, runtime, env, rm_tmpdir=True, move_outputs="move", secret_sto
228
234
if builder is not None :
229
235
job_script_contents = builder .build_job_script (commands )
230
236
rcode = _job_popen (
231
- commands ,
232
- stdin_path = stdin_path ,
233
- stdout_path = stdout_path ,
234
- stderr_path = stderr_path ,
235
- env = env ,
236
- cwd = self .outdir ,
237
- job_script_contents = job_script_contents ,
238
- )
237
+ commands , stdin_path , stdout_path , stderr_path , env ,
238
+ self .outdir , tempfile .mkdtemp (prefix = tmp_outdir_prefix ),
239
+ job_script_contents )
239
240
240
241
if self .successCodes and rcode in self .successCodes :
241
242
processStatus = "success"
@@ -415,16 +416,15 @@ def run(self, pull_image=True, rm_container=True,
415
416
416
417
417
418
def _job_popen (
418
- commands , # type: List[Text]
419
- stdin_path , # type: Text
420
- stdout_path , # type: Text
421
- stderr_path , # type: Text
419
+ commands , # type: List[Text]
420
+ stdin_path , # type: Text
421
+ stdout_path , # type: Text
422
+ stderr_path , # type: Text
422
423
env , # type: Union[MutableMapping[Text, Text], MutableMapping[str, str]]
423
- cwd , # type: Text
424
- job_dir = None , # type: Text
424
+ cwd , # type: Text
425
+ job_dir , # type: Text
425
426
job_script_contents = None , # type: Text
426
- ):
427
- # type: (...) -> int
427
+ ): # type: (...) -> int
428
428
if not job_script_contents and not FORCE_SHELLED_POPEN :
429
429
430
430
stdin = None # type: Union[IO[Any], int]
@@ -471,9 +471,6 @@ def _job_popen(
471
471
472
472
return rcode
473
473
else :
474
- if job_dir is None :
475
- job_dir = tempfile .mkdtemp (prefix = "cwltooljob" )
476
-
477
474
if not job_script_contents :
478
475
job_script_contents = SHELL_COMMAND_TEMPLATE
479
476
0 commit comments