Newer
Older

Christopher Randolph Rhodes
committed
from model_server.conf.defaults import root, server_conf

Christopher Randolph Rhodes
committed
from model_server.conf.startup import main

Christopher Randolph Rhodes
committed
def parse_args():
parser = argparse.ArgumentParser(
description='Start model server with optional arguments',
)

Christopher Randolph Rhodes
committed
parser.add_argument(
'--confpath',
default='model_server.conf.fastapi',

Christopher Randolph Rhodes
committed
help='path to server startup configuration',
)
parser.add_argument(
'--host',
help='bind socket to this host'
)
parser.add_argument(
'--port',
default=str(server_conf['port']),
help='bind socket to this port',

Christopher Randolph Rhodes
committed
parser.add_argument(
'--root',
default=root.__str__(),
help='root directory of session data'
)
parser.add_argument(
'--debug',
action='store_true',
help='display extra information that is helpful for debugging'
)
parser.add_argument(
'--reload',
action='store_true',
help='automatically restart server when changes are noticed, for development purposes'
)

Christopher Randolph Rhodes
committed
return parser.parse_args()

Christopher Randolph Rhodes
committed
if __name__ == '__main__':
args = parse_args()
print('CLI args:\n' + str(args))

Christopher Randolph Rhodes
committed
main(**args.__dict__)