-
Notifications
You must be signed in to change notification settings - Fork 88
[RAPTOR-14353] Run flask server using CLI (gunicorn with gevent support) #1633
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
Conversation
…eration to help prevent logic diverging (#1615) * Fix Drum Inline Runner and streamline DRUM options generation * Cleanup * Refactor setup to new file * Fix mocks * Add unit tests * Change tracer
Co-authored-by: GenAI Git Bot <[email protected]>
Bumps [keras](https://github.com/keras-team/keras) from 3.10.0 to 3.11.0. - [Release notes](https://github.com/keras-team/keras/releases) - [Commits](keras-team/keras@v3.10.0...v3.11.0) --- updated-dependencies: - dependency-name: keras dependency-version: 3.11.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* [RAPTOR-14453] Regen requirements.txt to fix CVE-2025-8747 This regenerates the requirements.txt file from requirements.in, to pull in the latest keras 3.11.2, upgrading from 3.10.0. Upgrading past 3.11.0 fixes CVE-2025-8747. * Reconcile dependencies, updated IDs, tags --------- Co-authored-by: svc-harness-git2 <[email protected]>
… chat` kwargs (#1621) * Update DRUM version * Update CHANGELOG.md
…onment (#1627) * Bump requirements in GenAI Agents environment * Update * Reconcile dependencies, updated IDs, tags --------- Co-authored-by: svc-harness-git2 <[email protected]>
…for credential cache daemon (#1630) * [CFX-3334] Update to latest drgithelper and properly set permissions for credential cache daemon * Reconcile dependencies, updated IDs, tags --------- Co-authored-by: svc-harness-git2 <[email protected]>
* [RAPTOR-13851] pytorch: rebuild requirements to pull in updates This rebuilds requirements.txt to pull in updates for pytorch to resolve CVE-2025-3730. * Reconcile dependencies, updated IDs, tags --------- Co-authored-by: svc-harness-git2 <[email protected]>
Co-authored-by: “Nickolai <“[email protected]”>
* addd timeouts * fiz black * fix tests * fixed black * add timeout * fixed * replaced with RuntimeParameters * removed unused import * replaced with static methods
* add watchdog * 5 attempts * watchdog_additional * fixed version * add env USE_NIM_WATCHDOG * add env USE_NIM_WATCHDOG * fixed lint * fixed version * rever docker changes * add changes * removed changelogs * max_attempts = 3 * replaced with os.kill(pid, signal.SIGTERM) * renamed * fixed comments * add NIM_WATCHDOG_REQUEST_TIMEOUT and NIM_WATCHDOG_MAX_ATTEMPTS * add logs * fix lint
# Conflicts: # custom_model_runner/datarobot_drum/drum/root_predictors/prediction_server.py # custom_model_runner/datarobot_drum/drum/runtime.py # public_dropin_environments/python311_genai_agents/env_info.json
…renkov/POC-gunicorn
The Needs Review labels were added based on the following file changes. Team @datarobot/core-modeling (#predictive-ai) was assigned because of changes in files:custom_model_runner/datarobot_drum/drum/drum.py custom_model_runner/datarobot_drum/drum/main.py custom_model_runner/datarobot_drum/drum/root_predictors/prediction_server.py custom_model_runner/datarobot_drum/drum/runtime.py custom_model_runner/datarobot_drum/drum/server.py Team @datarobot/genai-systems (#genai-systems) was assigned because of changes in files:custom_model_runner/datarobot_drum/drum/drum.py custom_model_runner/datarobot_drum/drum/main.py custom_model_runner/datarobot_drum/drum/root_predictors/prediction_server.py custom_model_runner/datarobot_drum/drum/runtime.py custom_model_runner/datarobot_drum/drum/server.py If you think that there are some issues with ownership, please discuss with C&A domain at #sdtk slack channel and create PR to update DRCODEOWNERS\CODEOWNERS file. |
signal interruptions, and starts the CMRunner for executing user-defined models. | ||
|
||
Args: | ||
flask_app: Optional[Flask] Flask application instance, used when running using command line. |
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.
..., used when running using command line.
It's always a command line, when running locally or when running DRUM in as a sidecar container.
Is the plan to setup Flask App when running DRUM as a sidecar?
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.
the old logic remains. It was made to run drum using command gunicorn -c gunicorn.conf.py app:app
if [ "$SERVER_TYPE" == "gunicorn" ]; then
echo "Starting gunicorn server..."
exec gunicorn -c gunicorn.conf.py app:app
else
echo "Starting werkzeug (dev Flask) server..."
exec drum server --sidecar --gpu-predictor=nim --logging-level=info "$@"
fi
# when running application via the command line (e.g., gunicorn worker) | ||
pass | ||
else: | ||
if RuntimeParameters.has("USE_NIM_WATCHDOG") and str( |
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.
this check for has(<attribute>)
is redundant as you can check for RuntimeParameters.get("USE_NIM_WATCHDOG", "no")
with default False value.
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.
ah, I see it was defined in the original version so not critical for applying in current PR, just a suggestion
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.
user should explicitly set this value.
signal interruptions, and starts the CMRunner for executing user-defined models. | ||
|
||
Args: | ||
flask_app: Optional[Flask] Flask application instance, used when running using command line. |
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.
flast_app
is not optional for DrumRuntime so it can't be optional for main()
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.
if flast_app is None it is created app = create_flask_app()
in def get_flask_app(api_blueprint):
if self.worker_ctx: | ||
# Add cleanup when running via the command line (gunicorn worker) | ||
self.worker_ctx.defer_cleanup( | ||
lambda: stats_collector.disable(), desc="stats_collector.disable()" |
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.
Probably lets add short but genuine descriptions, than simply the method name?
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.
added.
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.
LGTM you can address this before merge #1633 (review)
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.
LGTM for Predictive AI
Added support for running Flask from the command line. This is required for launching the Flask app using the Gunicorn server with Gevent.
To be integrated with the following PR:
https://github.com/datarobot/datarobot-custom-templates/pull/419