Skip to content

Commit 58d305d

Browse files
committed
fix drum
1 parent b7ff12a commit 58d305d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

custom_model_runner/datarobot_drum/drum/entry_point.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
from datarobot_drum.drum.gunicorn.run_gunicorn import main_gunicorn
22
from datarobot_drum.drum.main import main
3-
import sys
43
from datarobot_drum import RuntimeParameters
4+
from datarobot_drum.drum.utils.setup import setup_options
55

66

77
def run_drum_server():
8-
cmd_args = sys.argv
9-
is_server = False
10-
if len(cmd_args) > 1 and cmd_args[1] == "server":
11-
is_server = True
12-
8+
options = setup_options()
139
if (
14-
RuntimeParameters.has("DRUM_SERVER_TYPE")
10+
options.subparser_name == "server"
11+
and RuntimeParameters.has("DRUM_SERVER_TYPE")
1512
and str(RuntimeParameters.get("DRUM_SERVER_TYPE")).lower() == "gunicorn"
16-
and is_server
1713
):
1814
main_gunicorn()
1915
else:

custom_model_runner/datarobot_drum/drum/gunicorn/gunicorn.conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
if temp_loglevel in {"debug", "info", "warning", "error", "critical"}:
6767
loglevel = temp_loglevel
6868

69-
bind = os.environ.get("ADDRESS", "0.0.0.0:8080")
69+
bind = os.environ["ADDRESS"]
7070
# loglevel = "info"
7171
accesslog = "-"
7272
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'

custom_model_runner/datarobot_drum/drum/utils/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Released under the terms of DataRobot Tool and Utility Agreement.
66
"""
77

8+
import os
89
import sys
910

1011
from datarobot_drum import RuntimeParameters
@@ -48,6 +49,11 @@ def setup_options(args=None):
4849

4950
options = arg_parser.parse_args(args)
5051

52+
# Override env var from CLI parameter.
53+
# Now only ADDRESS is supported.
54+
if getattr(options, "address", None):
55+
os.environ["ADDRESS"] = options.address
56+
5157
"""Set max workers from runtime parameters if available."""
5258
if RuntimeParameters.has("CUSTOM_MODEL_WORKERS"):
5359
options.max_workers = RuntimeParameters.get("CUSTOM_MODEL_WORKERS")

0 commit comments

Comments
 (0)