@@ -409,7 +409,7 @@ def create_longterm_symlink(cherenkov_job_id: str=None):
409409 log .warning (f"Job { cherenkov_job_id } (lstchain_cherenkov_transparency) did not finish successfully." )
410410
411411
412- def create_runwise_datacheck_symlinks ():
412+ def create_runwise_datacheck_symlinks (parent_job_ids : List [ str ] ):
413413 """Create symlinks of the run-wise datacheck files in the "datacheck" directory."""
414414 nightdir = utils .date_to_dir (options .date )
415415 dl1_dir = Path (cfg .get ("LST1" , "DL1_DIR" )) / nightdir / options .prod_id
@@ -421,11 +421,24 @@ def create_runwise_datacheck_symlinks():
421421 "tailcut*/datacheck/datacheck_dl1_LST-1.Run?????.h5" ,
422422 ]
423423
424+ commands = []
424425 for pattern in patterns :
425426 for input_file in dl1_dir .rglob (pattern ):
426427 output_file = output_dir / input_file .name
427428 if not output_file .is_symlink ():
428- output_file .symlink_to (input_file .resolve ())
429+ commands .append (f'ln -s "$(realpath { input_file } )" { output_file } ' )
430+
431+ if commands :
432+ full_cmd = "\n " .join (commands )
433+
434+ sbatch_cmd = [
435+ "sbatch" ,
436+ f"--dependency=afterok:{ ',' .join (parent_job_ids )} " ,
437+ "--wrap" ,
438+ full_cmd ,
439+ ]
440+
441+ subprocess .run (sbatch_cmd , check = True )
429442
430443
431444def create_muons_symlinks ():
@@ -443,12 +456,12 @@ def create_muons_symlinks():
443456 output_file .symlink_to (input_file .resolve ())
444457
445458
446- def create_datacheck_symlinks ():
459+ def create_datacheck_symlinks (parent_job_ids : List [ str ] ):
447460 """Create symlinks of the run-wise datacheck files, and of the muon
448461 files in the "datacheck" directory."""
449462
450463 log .info ("Creating symlinks of the datacheck and muon files in the common directory." )
451- create_runwise_datacheck_symlinks ()
464+ create_runwise_datacheck_symlinks (parent_job_ids )
452465 create_muons_symlinks ()
453466
454467
0 commit comments