@@ -89,12 +89,10 @@ for line in f:
8989 if len (args ) > 2 and not 'O2_ROOT' in os .environ :
9090 print ('O2 not loaded' )
9191 raise
92- xml_postprocessing = ('GEN_TOPO_OOM_WORKAROUND' in os .environ and int (os .environ ['GEN_TOPO_OOM_WORKAROUND' ])) or ('GEN_TOPO_DDS_ASSETS' in os .environ and int (os .environ ['GEN_TOPO_DDS_ASSETS' ]))
93- if xml_postprocessing :
94- json_cache_path = os .environ ['GEN_TOPO_WORKDIR' ] + '/json_cache'
95- if not os .path .exists (json_cache_path ):
96- os .makedirs (json_cache_path , 0o770 )
97- os .environ ['GEN_TOPO_QC_JSON_FILE' ] = os .path .abspath (json_cache_path + '/qc_tmp_' + datetime .datetime .now ().strftime ('%y-%m-%d-%H-%M-%S' ) + '_' + str (random .randrange (100000000 )) + '.json' )
92+ json_cache_path = os .environ ['GEN_TOPO_WORKDIR' ] + '/json_cache'
93+ if not os .path .exists (json_cache_path ):
94+ os .makedirs (json_cache_path , 0o770 )
95+ os .environ ['GEN_TOPO_QC_JSON_FILE' ] = os .path .abspath (json_cache_path + '/qc_tmp_' + datetime .datetime .now ().strftime ('%y-%m-%d-%H-%M-%S' ) + '_' + str (random .randrange (100000000 )) + '.json' )
9896 with tempfile .TemporaryDirectory (prefix = 'o2_workflow_' ) as tmpdir :
9997 if 'GEN_TOPO_OVERRIDE_TEMPDIR' in os .environ :
10098 tmpdir = os .environ ['GEN_TOPO_OVERRIDE_TEMPDIR' ]
@@ -122,19 +120,10 @@ for line in f:
122120 print ('Adding' , wf [0 ], 'workflow (' , wf [2 ], '-' , wf [1 ], 'nodes):' , wf [3 ])
123121 reconodes = max (reconodes , int (wf [1 ]))
124122 reconodesmin = max (reconodesmin , int (wf [2 ]))
125- if 'GEN_TOPO_IGNORE_ERROR' in os .environ and int (os .environ ['GEN_TOPO_IGNORE_ERROR' ]):
126- command_log_filter = '"^\["'
127- else :
128- command_log_filter = '"^\[INFO"'
129- command_preopt = 'GEN_TOPO_CALIB_WORKFLOW=' + str (is_calib_workflow )
130- if xml_postprocessing :
131- filename_xml = filename
132- if not 'GEN_TOPO_WORKDIR' in os .environ :
133- print ('$GEN_TOPO_WORKDIR not set' )
134- raise
135- filename = json_cache_path + '/dpl_tmp_' + datetime .datetime .now ().strftime ('%y-%m-%d-%H-%M-%S' ) + wf [0 ] + str (i ) + '_' + str (random .randrange (100000000 )) + '.json'
136- command_preopt += ' WORKFLOWMODE=dump'
137- command = command_preopt + ' GLOBALDPLOPT+=" -b --dds-workflow-suffix _' + wf [0 ] + str (i ) + '" ' + wf [3 ] + ' | grep -v ' + command_log_filter + ' > ' + filename + ' && [ `grep "^\[" ' + filename + ' | wc -l` == 0 ]'
123+ command_preopt = 'GEN_TOPO_CALIB_WORKFLOW=' + str (is_calib_workflow ) + ' ${WORKFLOWMODE_FILE}=' + filename
124+ command = command_preopt + ' GLOBALDPLOPT+=" -b --dds-workflow-suffix _' + wf [0 ] + str (i ) + '" ' + wf [3 ]
125+ if os .environ ['WORKFLOWMODE' ] == 'print' :
126+ command += ' > ' + filename
138127 print ('Running DPL command' , command )
139128 if reco_num_nodes_override == 0 :
140129 os .environ ['RECO_NUM_NODES_WORKFLOW' ] = wf [1 ]
@@ -147,30 +136,6 @@ for line in f:
147136 break
148137 print (line )
149138 raise
150- if xml_postprocessing :
151- command = 'cat ' + filename + ' | o2-dpl-run -b --dds --dds-workflow-suffix _' + wf [0 ] + str (i ) + ' --resources-monitoring 15 ' + ' | grep -v ' + command_log_filter + ' > ' + filename_xml
152- print ('Running CAT command' , command )
153- if os .system (command ) != 0 :
154- print ('Error running command' , command )
155- if 'GEN_TOPO_OOM_WORKAROUND' in os .environ and int (os .environ ['GEN_TOPO_OOM_WORKAROUND' ]):
156- command = 'sed -i \' s,^\( *<exe reachable="true">\).*\(|[^|]*</exe>\)$,\\ 1 cat ' + filename + ' \\ 2,\' ' + filename_xml
157- if 'GEN_TOPO_DDS_ASSETS' in os .environ and int (os .environ ['GEN_TOPO_DDS_ASSETS' ]):
158- command = 'sed -i \' s/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/\' "\' "\' /\'/g\' ' + filename
159- print ('Running SED command for DPL JSON XML Escaping' , command )
160- if os .system (command ) != 0 :
161- print ('Error running sed on JSON file' )
162- asset_name = 'dpl_json_' + wf [0 ] + '_' + str (i )
163- command = 'sed -i ' + \
164- '-e \' s,^\( *<exe reachable="true">\).*\(|[^|]*</exe>\)$,\\ 1 cat ${DDS_LOCATION}/' + asset_name + '.asset \\ 2,\' ' + \
165- '-e \' /^ *<decltask name.*>$/a <assets><name>' + asset_name + '</name></assets>\' ' + \
166- '-e \' /^ *<topology name.*>$/a <asset name="' + asset_name + '" type="inline" visibility="global" value="\' ' + \
167- '-e \' /^ *<topology name.*>$/r ' + filename + '\' ' + \
168- '-e \' /^ *<topology name.*>$/a " />\' ' + \
169- filename_xml
170- print ('Running SED command' , command )
171- if os .system (command ) != 0 :
172- print ('Error running sed on XML file' )
173- filename = filename_xml
174139 if reco_num_nodes_override > 0 :
175140 reconodes = reco_num_nodes_override
176141 reconodesmin = min (reconodes , reconodesmin )
@@ -212,7 +177,7 @@ for line in f:
212177 if os .system (odccommand ) != 0 :
213178 print ('\n Error running odc: ' , odccommand )
214179 raise
215- if 'GEN_TOPO_DDS_ASSETS' in os . environ and int ( os . environ [ 'GEN_TOPO_DDS_ASSETS' ]) and os .path .exists (os .environ ['GEN_TOPO_QC_JSON_FILE' ]):
180+ if os .path .exists (os .environ ['GEN_TOPO_QC_JSON_FILE' ]):
216181 command = 'sed -i \' s/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/\' "\' "\' /\'/g\' ' + os .environ ['GEN_TOPO_QC_JSON_FILE' ]
217182 print ('Running SED command for DPL JSON XML Escaping' , command )
218183 if os .system (command ) != 0 :
0 commit comments