Skip to content
Snippets Groups Projects
Commit 5da2d3cb authored by Karim Ahmed's avatar Karim Ahmed
Browse files

copy conf.yaml after a trigger

parent d8c5bf2f
No related branches found
No related tags found
1 merge request!130fix/cpy_conf_after_req
...@@ -168,15 +168,17 @@ async def server_runner(conf_file): ...@@ -168,15 +168,17 @@ async def server_runner(conf_file):
socket.bind("{}:{}".format(config['GLOBAL']['report-service']['bind-to'], socket.bind("{}:{}".format(config['GLOBAL']['report-service']['bind-to'],
config['GLOBAL']['report-service']['port'])) config['GLOBAL']['report-service']['port']))
asyncio.ensure_future(copy_files(conf_file,
config['GLOBAL']['git']['figures-local'],
sem=None))
while True: while True:
response = await socket.recv_pyobj() response = await socket.recv_pyobj()
await socket.send_pyobj('Build DC reports through -->') await socket.send_pyobj('Build DC reports through -->')
logging.info("response: {}".format(response)) logging.info("response: {}".format(response))
# Send the conf.yaml file after receiving a zmq-req.
asyncio.ensure_future(copy_files(conf_file,
config['GLOBAL']['git']
['figures-local'],
sem=None))
# Check if response is a list or a dict. # Check if response is a list or a dict.
# if list, it should either have instrument names or ['all']. # if list, it should either have instrument names or ['all'].
# if dict, it should acquires the details of the requested reports # if dict, it should acquires the details of the requested reports
...@@ -238,7 +240,6 @@ async def server_runner(conf_file): ...@@ -238,7 +240,6 @@ async def server_runner(conf_file):
logging.info('Submission information: {}:' logging.info('Submission information: {}:'
.format(run_base)) .format(run_base))
except Exception as e: except Exception as e:
logging.error('Submission failed: {}'.format(e)) logging.error('Submission failed: {}'.format(e))
exit(1) exit(1)
...@@ -254,16 +255,13 @@ async def server_runner(conf_file): ...@@ -254,16 +255,13 @@ async def server_runner(conf_file):
logging.error('Submission Error: {}' logging.error('Submission Error: {}'
.format(output[1].decode('utf8'))) .format(output[1].decode('utf8')))
job_list += await parse_output(output[0].decode('utf8')) job_list += await parse_output(output[0].decode('utf8'))
try: try:
await asyncio.wait_for(wait_jobs(job_list), await asyncio.wait_for(wait_jobs(job_list),
timeout=jobs_timeout) timeout=jobs_timeout)
logging.info('All jobs are finished') logging.info('All jobs are finished')
except asyncio.TimeoutError: except asyncio.TimeoutError:
asyncio.ensure_future(del_folder('./tmp')) logging.error('Jobs have timed-out!')
logging.error('Jobs timeout!')
# Copy all plots # Copy all plots
for det_name, det_conf in instrument.items(): for det_name, det_conf in instrument.items():
...@@ -296,7 +294,6 @@ async def server_runner(conf_file): ...@@ -296,7 +294,6 @@ async def server_runner(conf_file):
logging.info('{} figures of {} are copied into {}'.format( logging.info('{} figures of {} are copied into {}'.format(
len(figures), det_name, path)) len(figures), det_name, path))
asyncio.ensure_future( asyncio.ensure_future(
push_figures(cfg['GLOBAL']['git']['repo-local'], push_figures(cfg['GLOBAL']['git']['repo-local'],
all_new_files)) all_new_files))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment