Skip to content

Commit bdc2fb0

Browse files
author
Sunil Thaha
committed
feat(server): support config-dir argument
Signed-off-by: Sunil Thaha <[email protected]>
1 parent 6b6b184 commit bdc2fb0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/kepler_model/server/model_server.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
from kepler_model.train import NodeTypeIndexCollection, NodeTypeSpec
1313
from kepler_model.util.config import (
14+
CONFIG_PATH,
1415
ERROR_KEY,
1516
MODEL_SERVER_MODEL_LIST_PATH,
1617
MODEL_SERVER_MODEL_REQ_PATH,
1718
download_path,
1819
getConfig,
1920
initial_pipeline_urls,
2021
model_toppath,
22+
set_config_dir,
2123
)
2224
from kepler_model.util.loader import (
2325
CHECKPOINT_FOLDERNAME,
@@ -430,11 +432,25 @@ def fill_machine_spec():
430432
default="info",
431433
required=False,
432434
)
433-
def run(log_level: str):
435+
@click.option(
436+
"--config-dir",
437+
"-c",
438+
type=click.Path(exists=False, dir_okay=True, file_okay=False),
439+
default=CONFIG_PATH,
440+
required=False,
441+
)
442+
def run(log_level: str, config_dir: str) -> int:
434443
level = getattr(logging, log_level.upper())
435-
logging.basicConfig(level=level)
444+
logging.basicConfig(
445+
level=level,
446+
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)s: %(message)s",
447+
datefmt="%Y-%m-%d %H:%M:%S",
448+
)
449+
450+
set_config_dir(config_dir)
436451
load_init_pipeline()
437452
app.run(host="0.0.0.0", port=MODEL_SERVER_PORT)
453+
return 0
438454

439455

440456
if __name__ == "__main__":

0 commit comments

Comments
 (0)