-
Notifications
You must be signed in to change notification settings - Fork 88
[RAPTOR-14627] use gunicorn in sklearn env #1659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1f8d755 to
8117a45
Compare
a099f48 to
af8d305
Compare
| ENV WITH_ERROR_SERVER=0 \ | ||
| PYTHONUNBUFFERED=1 | ||
|
|
||
| # ENV MLOPS_RUNTIME_PARAM_DRUM_CLIENT_REQUEST_TIMEOUT='{"type": "numeric", "payload": 660}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Commented-out configuration left in Dockerfile
A commented-out ENV MLOPS_RUNTIME_PARAM_DRUM_CLIENT_REQUEST_TIMEOUT line was added to the Dockerfile. This appears to be leftover testing or debugging code that was not removed before committing. Commented-out configuration in production Dockerfiles can confuse maintainers and suggests incomplete cleanup.
d60d02e to
c33186b
Compare
| loglevel = temp_loglevel | ||
|
|
||
| bind = os.environ.get("ADDRESS", "0.0.0.0:8080") | ||
| bind = os.environ["ADDRESS"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Removed ADDRESS default causes KeyError without fallback
The change from os.environ.get("ADDRESS", "0.0.0.0:8080") to os.environ["ADDRESS"] removes the fallback default. While the Dockerfiles set ENV ADDRESS=0.0.0.0:8080, running gunicorn outside of Docker without the --address CLI option and without the ADDRESS environment variable being set will cause a KeyError. The setup_options() function only sets ADDRESS if options.address is truthy, providing no guarantee the variable exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: setup_options called twice in non-gunicorn execution path
The run_drum_server() function calls setup_options() to determine if gunicorn should be used. When the condition is false (non-gunicorn path), it calls main(), which internally calls setup_options() again. This causes argument parsing, environment variable setup via RuntimeParametersLoader, lazy loading setup, and option verification to all run twice. The argcomplete missing warning would also print twice if the package is not installed. The previous implementation checked sys.argv[1] == "server" directly without requiring a full parse, avoiding this redundancy.
custom_model_runner/datarobot_drum/drum/entry_point.py#L9-L18
datarobot-user-models/custom_model_runner/datarobot_drum/drum/entry_point.py
Lines 9 to 18 in 90b7ce7
| def run_drum_server(): | |
| options = setup_options() | |
| if ( | |
| options.subparser_name == ArgumentsOptions.SERVER | |
| and RuntimeParameters.has("DRUM_SERVER_TYPE") | |
| and str(RuntimeParameters.get("DRUM_SERVER_TYPE")).lower() == "gunicorn" | |
| ): | |
| main_gunicorn() | |
| else: | |
| main() |
60c0fd0 to
3cfe4cd
Compare
23016e2 to
a86d8b7
Compare
|
|
||
| @pytest.mark.parametrize( | ||
| "with_error_server, production, docker", | ||
| [(False, False, None), (True, False, None), (True, True, DOCKER_PYTHON_SKLEARN)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Inconsistent test parameter updates for gunicorn compatibility
The PR updates test parameters for test_e2e_no_model_artifact and test_e2e_model_loading_fails from (True, True, DOCKER_PYTHON_SKLEARN) to (False, False, DOCKER_PYTHON_SKLEARN) with comments explaining that gunicorn doesn't support error server or production mode. However, test_ping_endpoints (line 108) and test_e2e_predict_fails (line 188) still use (True, True, DOCKER_PYTHON_SKLEARN). If gunicorn truly doesn't support these modes, these tests will fail when run against the updated sklearn docker image.
This repository is public. Do not put here any private DataRobot or customer's data: code, datasets, model artifacts, .etc.
Summary
Rationale
Note
Standardizes Gunicorn as the DRUM server across drop-in environments, bumps datarobot-drum to 1.17.10, updates env version IDs/tags, and adjusts tests accordingly.
MLOPS_RUNTIME_PARAM_DRUM_SERVER_TYPEto"gunicorn"in Dockerfiles forjava_codegen,python311,python3_keras,python3_onnx,python3_pytorch,python3_sklearn,python3_xgboost, andr_lang.env_info.jsonenvironmentVersionIdand correspondingtagsfor all affected environments.datarobot-drumto1.17.10across requirements (includingpython311_genai_agents); regeneraterequirements.txtfor Python 3.11 with updated pip-compile metadata and includegunicornwhere applicable.tests/functional/test_drum_server_failures.pyparametrization to avoidwith_error_server/productionforDOCKER_PYTHON_SKLEARNand add notes reflecting Gunicorn usage.Written by Cursor Bugbot for commit 5383bbf. This will update automatically on new commits. Configure here.