Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions Configuration/PyReleaseValidation/python/WorkFlowRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,33 @@ def doCmd(self, cmd):

return ret

@staticmethod
def replace_filein_extensions(command_line, extension):
# Pattern to match --filein followed by file:file.ext entries (comma-separated)
filein_pattern = re.compile(
r'(--filein\s+)((?:file:[a-zA-Z0-9_]+\.[a-z]+(?:,\s*)?)*)'
)

# Inner pattern to match individual file entries
file_pattern = re.compile(r'file:([a-zA-Z0-9_]+)\.[a-z]+')

def replace_filein_match(filein_match):
filein_prefix = filein_match.group(1)
file_list_str = filein_match.group(2)

# Replace extensions in the file list
new_file_list = file_pattern.sub(
lambda m: 'file:{0}{1}'.format(m.group(1), extension),
file_list_str
)

return filein_prefix + new_file_list

# Replace the whole --filein section with updated extensions
new_command_line = filein_pattern.sub(replace_filein_match, command_line)

return new_command_line

def run(self):

startDir = os.getcwd()
Expand Down Expand Up @@ -208,22 +235,8 @@ def closeCmd(i,ID):
else:
cmd+=' --filein file:step%s%s '%(istep-1,extension)
elif istep!=1 and '--filein' in cmd and '--filetype' not in cmd:
#make sure correct extension is being used
#find the previous state index
expression = '--filein\s+file:step([1-9])(_[a-zA-Z]+)*\.[a-z]+'
m = re.search(expression, cmd)
if m:
cmd = re.sub(expression,r'--filein file:step\1\2'+outputExtensionForStep[int(m.group(1))],cmd)
elif extension == '.rntpl':
#some ALCA steps use special file names without step_ prefix and these are also force to use RNTuple
expression = '--filein\s+file:([a-zA-Z0-9_]+)*\.[a-z]+'
m = re.search(expression, cmd)
if m:
cmd = re.sub(expression,r'--filein file:\1.rntpl',cmd)
expression = '--filein\s+file:([a-zA-Z0-9_]+)*\.[a-z]+, *file:([a-zA-Z0-9_]+)*\.[a-z]+'
m = re.search(expression, cmd)
if m:
cmd = re.sub(expression,r'--filein file:\1.rntpl,file:\2.rntpl',cmd)
# make sure correct extension is being used
cmd = self.replace_filein_extensions(cmd, extension)
if not '--fileout' in com:
cmd+=' --fileout file:step%s%s '%(istep,extension)
if "RECO" in cmd:
Expand Down