Skip to content

Commit 68a8aa7

Browse files
committed
Workflow parser: initial support for DDS assets
1 parent 271dc14 commit 68a8aa7

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

DATA/tools/parse

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +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']))
9293
with tempfile.TemporaryDirectory(prefix='o2_workflow_') as tmpdir:
94+
if 'GEN_TOPO_OVERRIDE_TEMPDIR' in os.environ:
95+
tmpdir = os.environ['GEN_TOPO_OVERRIDE_TEMPDIR']
9396
if NO_PROCESSING_MODE and len(args) > 2:
9497
print('Cannot use DPL workflow together with DD mode', os.environ['DDMODE'])
9598
raise
@@ -119,7 +122,7 @@ for line in f:
119122
else:
120123
command_log_filter = '"^\[INFO"'
121124
command_preopt = 'GEN_TOPO_CALIB_WORKFLOW=' + str(is_calib_workflow)
122-
if 'GEN_TOPO_OOM_WORKAROUND' in os.environ and int(os.environ['GEN_TOPO_OOM_WORKAROUND']):
125+
if xml_postprocessing:
123126
json_cache_path = os.environ['GEN_TOPO_WORKDIR'] + '/json_cache'
124127
filename_xml = filename
125128
if not 'GEN_TOPO_WORKDIR' in os.environ:
@@ -142,12 +145,20 @@ for line in f:
142145
break
143146
print(line)
144147
raise
145-
if 'GEN_TOPO_OOM_WORKAROUND' in os.environ and int(os.environ['GEN_TOPO_OOM_WORKAROUND']):
148+
if xml_postprocessing:
146149
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
147150
print('Running CAT command', command)
148151
if os.system(command) != 0:
149152
print('Error running command', command)
150-
command = 'sed -i \'s,^\( *.exe.*sleep [0-9.]*;\).*\(|[^|]*./exe.\)$,\\1 cat ' + filename + ' \\2,\' ' + filename_xml
153+
if 'GEN_TOPO_OOM_WORKAROUND' in os.environ and int(os.environ['GEN_TOPO_OOM_WORKAROUND']):
154+
command = 'sed -i \'s,^\( *.exe.*sleep [0-9.]*;\).*\(|[^|]*./exe.\)$,\\1 cat ' + filename + ' \\2,\' ' + filename_xml
155+
if 'GEN_TOPO_DDS_ASSETS' in os.environ and int(os.environ['GEN_TOPO_DDS_ASSETS']):
156+
asset_name = 'dpl_json_' + wf[0] + '_' + str(i)
157+
command = 'sed -i ' + \
158+
'-e \'s,^\( *.exe.*sleep [0-9.]*;\).*\(|[^|]*./exe.\)$,\\1 cat ${DDS_LOCATION}/' + asset_name + ' \\2,\' ' + \
159+
'-e \'s,^\( *.decltask name.*>$\),\\1 <assets><name>' + asset_name + '</name></assets>,\' ' + \
160+
'-e \'s,^\( *.topology name.*>$\),\\1 <asset name="' + asset_name + '" type="inline" visibility="global" value="foo" />,\' ' + \
161+
filename_xml
151162
print('Running SED command', command)
152163
if os.system(command) != 0:
153164
print('Error running sed on XML file')

0 commit comments

Comments
 (0)