@@ -26,6 +26,9 @@ def parse_args():
2626 parser .add_argument ('--runs-csv-file' , dest = 'runs_file' , action = 'store' , help = 'A csv file with a header and the '
2727 'columns `runNumber` and `runType`' ,
2828 required = True )
29+ parser .add_argument ('--fallback-runtype' , dest = 'fallback_runtype' , action = 'store' , help = ' default to this run type '
30+ 'if a run is not found in the csv file. If this argument is not specified, the unknown runs are simply skipped.' ,
31+ default = None )
2932 parser .add_argument ('--print-list' , action = 'store_true' , help = 'Only print the list of objects that would be updated' )
3033 parser .add_argument ('--yes' , action = 'store_true' , help = 'Answers yes to all. You should be really careful with that.' )
3134 parser .add_argument ('--path-no-subdir' , action = 'store_true' , default = False , help = 'Set to true if the '
@@ -80,11 +83,18 @@ def run(args):
8083 logging .debug (f"{ version } misses metadata RunNumber" )
8184 continue
8285 run_number = version .metadata ["RunNumber" ]
86+
8387 if version .metadata ["RunNumber" ] not in mapping_run_types :
8488 logging .debug (f"{ version } : No mapping for run { version .metadata ['RunNumber' ]} " )
85- continue
89+ if not args .fallback_runtype :
90+ logging .debug (f" fSkipping version as there is fallback_runtype is not set. " )
91+ continue
92+ else :
93+ logging .debug (f" fUsing fallback_runtype instead ({ args .fallback_runtype } )" )
94+ run_type = args .fallback_runtype
95+ else :
96+ run_type = mapping_run_types [run_number ]
8697
87- run_type = mapping_run_types [run_number ]
8898 old_run_type = version .metadata ['RunType' ] if 'RunType' in version .metadata else "null"
8999 if old_run_type != run_type :
90100 logging .info (f"Ready to update { version } : \" { old_run_type } \" -> \" { run_type } \" " )
0 commit comments