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

timeout and parseargs help msgs

parent af3bbbc5
No related branches found
No related tags found
Loading
......@@ -9,7 +9,7 @@ import yaml
import zmq
import zmq.asyncio
async def auto_run(cfg):
async def auto_run(cfg, timeout=3000):
"""
Run the report service automatically depending on the scheduled times
in the run_time list, read from the config yaml file (report_conf.yaml)
......@@ -38,6 +38,8 @@ async def auto_run(cfg):
con = zmq.asyncio.Context()
sock = con.socket(zmq.REQ)
port = cfg['GLOBAL']['server-port']
sock.SNDTIMEO = timeout
sock.RCVTIMEO = timeout
sock.connect(port)
await sock.send_pyobj(['all'])
msg = await sock.recv_pyobj()
......@@ -51,14 +53,20 @@ async def auto_run(cfg):
# check every 10mins, if there is
# a need for an automatic-run.
await asyncio.sleep(600)
await asyncio.sleep(3000)
arg_parser = argparse.ArgumentParser(description='Automatic Launch')
arg_parser.add_argument('--config-file', type=str, default='./report_conf.yaml')
arg_parser.add_argument('--log-file', type=str, default='./report.log')
arg_parser.add_argument('--config-file', type=str,
default='./report_conf.yaml',
help='config file path with reportservice port. '
'Default=./report_conf.yaml')
arg_parser.add_argument('--log-file', type=str, default='./report.log',
help='The report log file path. Default=./report.log')
arg_parser.add_argument('--logging', type=str, default="INFO",
choices=['INFO', 'DEBUG', 'ERROR'])
help='logging modes: INFO, DEBUG or ERROR. '
'Default=INFO',
choices=['INFO', 'DEBUG', 'ERROR'])
if __name__ == "__main__":
args = vars(arg_parser.parse_args())
......
......@@ -33,13 +33,23 @@ def manual_run(request, cfg):
logging.info('{} Manual Run'.format(msg))
arg_parser = argparse.ArgumentParser(description='Manual Launch')
arg_parser.add_argument('--instrument', default=['all'], nargs='+')
arg_parser.add_argument('--testing', dest='testing', action='store_true')
arg_parser.add_argument('--instrument', default=['all'], nargs='+',
help='select the requested instruments. '
'Default=all')
arg_parser.add_argument('--testing', dest='testing', action='store_true',
help='required for testing with different'
'config files')
arg_parser.set_defaults(testing=False)
arg_parser.add_argument('--config-file', type=str, default='./report_conf.yaml')
arg_parser.add_argument('--log-file', type=str, default='./report.log')
arg_parser.add_argument('--logging', type=str, default="INFO",
choices=['INFO', 'DEBUG', 'ERROR'])
arg_parser.add_argument('--config-file', type=str,
default='./report_conf.yaml',
help='config file path with reportservice port. '
'Default=./report_conf.yaml')
arg_parser.add_argument('--log-file', type=str, default='./report.log',
help='The report log file path. Default=./report.log')
arg_parser.add_argument('--logging', type=str, default="INFO",
help='logging modes: INFO, DEBUG or ERROR. '
'Default=INFO',
choices=['INFO', 'DEBUG', 'ERROR'])
if __name__ == "__main__":
args = vars(arg_parser.parse_args())
......
......@@ -269,10 +269,16 @@ async def server_runner(config):
break
arg_parser = argparse.ArgumentParser(description='Start the report service')
arg_parser.add_argument('--config-file', type=str, default='./report_conf.yaml')
arg_parser.add_argument('--log-file', type=str, default='./report.log')
arg_parser.add_argument('--config-file', type=str,
default='./report_conf.yaml',
help='config file path with reportservice port. '
'Default=./report_conf.yaml')
arg_parser.add_argument('--log-file', type=str, default='./report.log',
help='The report log file path. Default=./report.log')
arg_parser.add_argument('--logging', type=str, default="INFO",
choices=['INFO', 'DEBUG', 'ERROR'])
help='logging modes: INFO, DEBUG or ERROR. '
'Default=INFO',
choices=['INFO', 'DEBUG', 'ERROR'])
if __name__ == "__main__":
args = vars(arg_parser.parse_args())
......
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