@@ -24,6 +24,9 @@ def parse_args():
2424 parser .add_argument ('--runs-csv-file' , dest = 'runs_file' , action = 'store' , help = 'A csv file with a header and the '
2525 'columns `runNumber` and `runType`' ,
2626 required = True )
27+ parser .add_argument ('--fallback-runtype' , dest = 'fallback_runtype' , action = 'store' , help = ' default to this run type '
28+ 'if a run is not found in the csv file. If this argument is not specified, the unknown runs are simply skipped.' ,
29+ default = None )
2730 parser .add_argument ('--print-list' , action = 'store_true' , help = 'Only print the list of objects that would be updated' )
2831 parser .add_argument ('--yes' , action = 'store_true' , help = 'Answers yes to all. You should be really careful with that.' )
2932 parser .add_argument ('--path-no-subdir' , action = 'store_true' , default = False , help = 'Set to true if the '
@@ -78,11 +81,18 @@ def run(args):
7881 logging .debug (f"{ version } misses metadata RunNumber" )
7982 continue
8083 run_number = version .metadata ["RunNumber" ]
84+
8185 if version .metadata ["RunNumber" ] not in mapping_run_types :
8286 logging .debug (f"{ version } : No mapping for run { version .metadata ['RunNumber' ]} " )
83- continue
87+ if not args .fallback_runtype :
88+ logging .debug (f" fSkipping version as there is fallback_runtype is not set. " )
89+ continue
90+ else :
91+ logging .debug (f" fUsing fallback_runtype instead ({ args .fallback_runtype } )" )
92+ run_type = args .fallback_runtype
93+ else :
94+ run_type = mapping_run_types [run_number ]
8495
85- run_type = mapping_run_types [run_number ]
8696 old_run_type = version .metadata ['RunType' ] if 'RunType' in version .metadata else "null"
8797 if old_run_type != run_type :
8898 logging .info (f"Ready to update { version } : \" { old_run_type } \" -> \" { run_type } \" " )
0 commit comments