@@ -379,7 +379,7 @@ def _execute(
379
379
stderr_path = stderr_path ,
380
380
env = env ,
381
381
cwd = self .outdir ,
382
- job_dir = runtimeContext .create_outdir (),
382
+ make_job_dir = lambda : runtimeContext .create_outdir (),
383
383
job_script_contents = job_script_contents ,
384
384
timelimit = self .timelimit ,
385
385
name = self .name ,
@@ -909,7 +909,7 @@ def _job_popen(
909
909
stderr_path : Optional [str ],
910
910
env : MutableMapping [str , str ],
911
911
cwd : str ,
912
- job_dir : str ,
912
+ make_job_dir : Callable [[], str ] ,
913
913
job_script_contents : Optional [str ] = None ,
914
914
timelimit : Optional [int ] = None ,
915
915
name : Optional [str ] = None ,
@@ -1004,11 +1004,12 @@ def terminate(): # type: () -> None
1004
1004
"stdin_path" : stdin_path ,
1005
1005
}
1006
1006
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 ()
1011
1008
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 )
1012
1013
job_script = os .path .join (job_dir , "run_job.bash" )
1013
1014
with open (job_script , "wb" ) as _ :
1014
1015
_ .write (job_script_contents .encode ("utf-8" ))
0 commit comments