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

move timout ctrl from CL to conf.yaml

parent 606d1287
No related branches found
No related tags found
1 merge request!117Fix/reportservice timeout from conf
...@@ -136,7 +136,7 @@ async def push_figures(repo_master, addf): ...@@ -136,7 +136,7 @@ async def push_figures(repo_master, addf):
logging.info('Pushed to git') logging.info('Pushed to git')
async def server_runner(conf_file, jobs_timeout): async def server_runner(conf_file):
""" """
The main server loop. After pulling the latest changes The main server loop. After pulling the latest changes
of the DC project, it awaits receiving configurations of the DC project, it awaits receiving configurations
...@@ -201,10 +201,12 @@ async def server_runner(conf_file, jobs_timeout): ...@@ -201,10 +201,12 @@ async def server_runner(conf_file, jobs_timeout):
continue continue
logging.info('Requested Configuration: {}'.format(req_cfg)) logging.info('Requested Configuration: {}'.format(req_cfg))
async def do_action(cfg, jobs_timeout=3000): async def do_action(cfg):
logging.info('Run plot production') logging.info('Run plot production')
jobs_timeout = cfg['GLOBAL']['report-service']['job-timeout']
all_new_files = [] all_new_files = []
all_new_files.append('{}/{}'.format(config['GLOBAL'] all_new_files.append('{}/{}'.format(config['GLOBAL']
['git'] ['git']
...@@ -301,9 +303,8 @@ async def server_runner(conf_file, jobs_timeout): ...@@ -301,9 +303,8 @@ async def server_runner(conf_file, jobs_timeout):
return return
try: try:
asyncio.ensure_future(do_action(copy.copy(req_cfg), jobs_timeout)) asyncio.ensure_future(do_action(copy.copy(req_cfg)))
except Exception as e: # actions that fail are only error logged except Exception as e: # actions that fail are only error logged
logging.error(str(e)) logging.error(str(e))
break break
...@@ -313,8 +314,6 @@ arg_parser.add_argument('--config-file', type=str, ...@@ -313,8 +314,6 @@ arg_parser.add_argument('--config-file', type=str,
default='./report_conf.yaml', default='./report_conf.yaml',
help='config file path with reportservice port. ' help='config file path with reportservice port. '
'Default=./report_conf.yaml') 'Default=./report_conf.yaml')
arg_parser.add_argument('--jobs-timeout', type=int, default=3000,
help='Maximum time to wait for jobs. Default=3000')
arg_parser.add_argument('--log-file', type=str, default='./report.log', arg_parser.add_argument('--log-file', type=str, default='./report.log',
help='The report log file path. Default=./report.log') help='The report log file path. Default=./report.log')
arg_parser.add_argument('--logging', type=str, default="INFO", arg_parser.add_argument('--logging', type=str, default="INFO",
...@@ -335,5 +334,5 @@ if __name__ == "__main__": ...@@ -335,5 +334,5 @@ if __name__ == "__main__":
datefmt='%Y-%m-%d %H:%M:%S') datefmt='%Y-%m-%d %H:%M:%S')
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.run_until_complete(server_runner(conf_file, args["jobs_timeout"])) loop.run_until_complete(server_runner(conf_file))
loop.close() loop.close()
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