Commit 72ee1bd9 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

[SCRIPTS] Add cleanup_script to lima_launcher

parent 9111e988
......@@ -13,6 +13,10 @@
"conda": {
"environment": "jungfrau_lima1"
},
"cleanup_script": ["det_id=1",
"sls_detector_put ${det_id}-rx_hostname none",
"sls_detector_put ${det_id}-stop",
"sls_detector_put ${det_id}-free"],
"cpu_affinity": {
"lima": {"ranges": [[ 8, 28], [ 40, 60], [ 72, 92], [104, 124]]},
"other": {"ranges": [[ 28, 31], [ 60, 63], [ 92, 95], [124, 127]]},
......
......@@ -52,12 +52,15 @@ class Environment(ExitStack):
cpu_affinity['script'] = script
if not (args and args.skip_set_cpu_affinity):
cpu_affinity['config'] = config.get('cpu_affinity', {})
self.cpu_affinity['cmd_list'] = []
cpu_affinity['cmd_list'] = []
self.cpu_affinity = cpu_affinity
def __enter__(self):
super().__enter__()
if self.config.get('cleanup_script', []):
self.callback(self.run_cleanup_script)
cpu_affinity = self.cpu_affinity
if cpu_affinity['config'] and cpu_affinity['script']:
temp_file = get_temp_file(prefix='cpu_affinity_config')
......@@ -120,6 +123,14 @@ class Environment(ExitStack):
running_proc.communicate()
return running_proc
def run_cleanup_script(self):
with get_temp_file(prefix='launcher_cleanup_script') as fname:
with open(fname, 'wt') as f:
script = '\n'.join(self.config.get('cleanup_script'))
f.write(script)
print(f'Executing cleanup script: {script}')
self.run_system_cmd('.', fname, skip_set_cpu_affinity=True)
def get_tango_json_config(server, instance):
db = tango.Database()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment