@@ -204,7 +204,7 @@ def checksum(self):
204204
205205 @property
206206 def lockfile (self ):
207- return self .output_dir .with_suffix (".lock" )
207+ return self .cache_dir .with_suffix (".lock" )
208208
209209 @property
210210 def uid (self ):
@@ -225,7 +225,7 @@ def can_resume(self):
225225 return self ._can_resume
226226
227227 @property
228- def output_dir (self ):
228+ def cache_dir (self ):
229229 """Get the filesystem path where outputs will be written."""
230230 return self .cache_root / self .checksum
231231
@@ -258,7 +258,7 @@ def inputs(self) -> dict[str, ty.Any]:
258258 if value and TypeParser .contains_type (FileSet , fld .type ):
259259 copied_value = copy_nested_files (
260260 value = value ,
261- dest_dir = self .output_dir ,
261+ dest_dir = self .cache_dir ,
262262 mode = fld .copy_mode ,
263263 collation = fld .copy_collation ,
264264 supported_modes = self .SUPPORTED_COPY_MODES ,
@@ -267,7 +267,7 @@ def inputs(self) -> dict[str, ty.Any]:
267267 map_copyfiles [name ] = copied_value
268268 self ._inputs .update (
269269 template_update (
270- self .task , output_dir = self .output_dir , map_copyfiles = map_copyfiles
270+ self .task , output_dir = self .cache_dir , map_copyfiles = map_copyfiles
271271 )
272272 )
273273 return self ._inputs
@@ -285,11 +285,11 @@ def _populate_filesystem(self):
285285 # and the lockfile has to be removed
286286 with open (self .cache_root / f"{ self .uid } _info.json" , "w" ) as jsonfile :
287287 json .dump ({"checksum" : self .checksum }, jsonfile )
288- if not self .can_resume and self .output_dir .exists ():
289- shutil .rmtree (self .output_dir )
290- self .output_dir .mkdir (parents = False , exist_ok = self .can_resume )
288+ if not self .can_resume and self .cache_dir .exists ():
289+ shutil .rmtree (self .cache_dir )
290+ self .cache_dir .mkdir (parents = False , exist_ok = self .can_resume )
291291 # Save job pkl into the output directory for future reference
292- save (self .output_dir , job = self )
292+ save (self .cache_dir , job = self )
293293
294294 def run (self , rerun : bool = False ):
295295 """Prepare the job working directory, execute the task, and save the
@@ -316,16 +316,16 @@ def run(self, rerun: bool = False):
316316 return result
317317 cwd = os .getcwd ()
318318 self ._populate_filesystem ()
319- os .chdir (self .output_dir )
319+ os .chdir (self .cache_dir )
320320 result = Result (
321321 outputs = None ,
322322 runtime = None ,
323323 errored = False ,
324- output_dir = self .output_dir ,
324+ output_dir = self .cache_dir ,
325325 task = self .task ,
326326 )
327327 self .hooks .pre_run_task (self )
328- self .audit .start_audit (odir = self .output_dir )
328+ self .audit .start_audit (odir = self .cache_dir )
329329 if self .audit .audit_check (AuditFlag .PROV ):
330330 self .audit .audit_task (job = self )
331331 try :
@@ -335,13 +335,13 @@ def run(self, rerun: bool = False):
335335 except Exception :
336336 etype , eval , etr = sys .exc_info ()
337337 traceback = format_exception (etype , eval , etr )
338- record_error (self .output_dir , error = traceback )
338+ record_error (self .cache_dir , error = traceback )
339339 result .errored = True
340340 raise
341341 finally :
342342 self .hooks .post_run_task (self , result )
343343 self .audit .finalize_audit (result = result )
344- save (self .output_dir , result = result , job = self )
344+ save (self .cache_dir , result = result , job = self )
345345 # removing the additional file with the checksum
346346 (self .cache_root / f"{ self .uid } _info.json" ).unlink ()
347347 os .chdir (cwd )
@@ -377,26 +377,26 @@ async def run_async(self, rerun: bool = False) -> Result:
377377 outputs = None ,
378378 runtime = None ,
379379 errored = False ,
380- output_dir = self .output_dir ,
380+ output_dir = self .cache_dir ,
381381 task = self .task ,
382382 )
383383 self .hooks .pre_run_task (self )
384- self .audit .start_audit (odir = self .output_dir )
384+ self .audit .start_audit (odir = self .cache_dir )
385385 try :
386386 self .audit .monitor ()
387387 await self .task ._run_async (self , rerun )
388388 result .outputs = self .task .Outputs ._from_task (self )
389389 except Exception :
390390 etype , eval , etr = sys .exc_info ()
391391 traceback = format_exception (etype , eval , etr )
392- record_error (self .output_dir , error = traceback )
392+ record_error (self .cache_dir , error = traceback )
393393 result .errored = True
394394 self ._errored = True
395395 raise
396396 finally :
397397 self .hooks .post_run_task (self , result )
398398 self .audit .finalize_audit (result = result )
399- save (self .output_dir , result = result , job = self )
399+ save (self .cache_dir , result = result , job = self )
400400 # removing the additional file with the checksum
401401 (self .cache_root / f"{ self .uid } _info.json" ).unlink ()
402402 os .chdir (cwd )
@@ -483,7 +483,7 @@ def result(self, return_inputs=False):
483483 outputs = None ,
484484 runtime = None ,
485485 errored = True ,
486- output_dir = self .output_dir ,
486+ output_dir = self .cache_dir ,
487487 task = self .task ,
488488 )
489489
@@ -614,22 +614,22 @@ def load_and_run(job_pkl: Path, rerun: bool = False) -> Path:
614614 save (job_pkl .parent , result = result )
615615 raise
616616
617- resultfile = job .output_dir / "_result.pklz"
617+ resultfile = job .cache_dir / "_result.pklz"
618618 try :
619619 if job .is_async :
620620 job .submitter .submit (job , rerun = rerun )
621621 else :
622622 job .run (rerun = rerun )
623623 except Exception as e :
624624 # creating result and error files if missing
625- errorfile = job .output_dir / "_error.pklz"
625+ errorfile = job .cache_dir / "_error.pklz"
626626 if not errorfile .exists (): # not sure if this is needed
627627 etype , eval , etr = sys .exc_info ()
628628 traceback = format_exception (etype , eval , etr )
629- errorfile = record_error (job .output_dir , error = traceback )
629+ errorfile = record_error (job .cache_dir , error = traceback )
630630 if not resultfile .exists (): # not sure if this is needed
631631 result = Result (output = None , runtime = None , errored = True , task = None )
632- save (job .output_dir , result = result )
632+ save (job .cache_dir , result = result )
633633 e .add_note (f" full crash report is here: { errorfile } " )
634634 raise
635635 return resultfile
0 commit comments