Skip to content
Snippets Groups Projects
Commit 7a21ddfd authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Parameterize reload to command line option

parent 9a3afeff
No related branches found
No related tags found
3 merge requests!37Release 2024.04.19,!34Revert "Temporary error-handling for debug...",!15Changes supporting AutoMic integration
...@@ -27,10 +27,15 @@ def parse_args(): ...@@ -27,10 +27,15 @@ def parse_args():
action='store_true', action='store_true',
help='display extra information that is helpful for debugging' help='display extra information that is helpful for debugging'
) )
parser.add_argument(
'--reload',
action='store_false',
help='automatically restart server when changes are noticed, for development purposes'
)
return parser.parse_args() return parser.parse_args()
def main(args, app_name='model_server.base.api:app', reload=False) -> None: def main(args, app_name='model_server.base.api:app') -> None:
print('CLI args:\n' + str(args)) print('CLI args:\n' + str(args))
server_process = Process( server_process = Process(
...@@ -41,9 +46,9 @@ def main(args, app_name='model_server.base.api:app', reload=False) -> None: ...@@ -41,9 +46,9 @@ def main(args, app_name='model_server.base.api:app', reload=False) -> None:
'host': args.host, 'host': args.host,
'port': int(args.port), 'port': int(args.port),
'log_level': 'debug', 'log_level': 'debug',
'reload': reload, 'reload': args.reload,
}, },
daemon=(reload is False), daemon=(args.reload is False),
) )
url = f'http://{args.host}:{int(args.port):04d}/status' url = f'http://{args.host}:{int(args.port):04d}/status'
print(url) print(url)
......
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