Skip to content

fix: properly handle NONE case for runtime executor - #997

Open
mckornfield wants to merge 9 commits into
mainfrom
no-docker-local-fixes/mck
Open

fix: properly handle NONE case for runtime executor#997
mckornfield wants to merge 9 commits into
mainfrom
no-docker-local-fixes/mck

Conversation

@mckornfield

@mckornfield mckornfield commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling when Docker is unavailable or cannot connect.
    • Unavailable Docker-backed execution profiles are now skipped instead of preventing other backends from starting.
    • Invalid default executors are cleared with a warning, allowing the platform to continue loading.
    • Advertised execution profiles now stay synchronized with successfully available backends.
    • Platform startup reports Docker-related failures more clearly and exits promptly when services stop unexpectedly.
  • Tests
    • Added coverage for Docker availability, backend registration, profile filtering, and startup failure scenarios.

@mckornfield
mckornfield requested review from a team as code owners July 30, 2026 18:54
@github-actions github-actions Bot added the fix label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Executor availability and runtime compatibility

Layer / File(s) Summary
Docker backend availability and registry handling
plugins/nemo-deployments/src/nemo_deployments_plugin/backends/{base.py,docker/backend.py,registry.py}, plugins/nemo-deployments/tests/unit/..., packages/nemo_platform_plugin/{src,tests}/...
Docker package, daemon, connection, timeout, request, and OS failures now use Docker-unavailable handling. Registries skip affected executors and clear invalid defaults.
Jobs backend registration and advertised profile synchronization
services/core/jobs/src/nmp/core/jobs/controllers/backends/registry.py, services/core/jobs/src/nmp/core/jobs/controllers/main.py, services/core/jobs/tests/test_config.py
Jobs backend registration skips unavailable Docker profiles. Advertised profiles now match successfully registered backends.
Runtime-aware executor profile merging
services/core/jobs/src/nmp/core/jobs/config.py, services/core/jobs/src/nmp/core/jobs/controllers/backends/config.py, services/core/jobs/tests/test_config.py
Profile merging uses the cached platform runtime and filters unsupported Kubernetes, Volcano, and unavailable Docker profiles.
Service startup and readiness failure handling
packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/setup.py, packages/nemo_platform_ext/tests/cli/commands/test_setup.py
Readiness polling detects an exited service process. Startup failures include conditional Docker availability guidance.

Sequence Diagram(s)

sequenceDiagram
  participant SetupCommand
  participant ServiceProcess
  participant Platform
  SetupCommand->>ServiceProcess: start services
  SetupCommand->>Platform: poll readiness with process
  Platform-->>SetupCommand: readiness result
  SetupCommand->>ServiceProcess: check exit status on failure
  ServiceProcess-->>SetupCommand: return exit code
Loading

Possibly related PRs

Suggested reviewers: ironcommit, mikeknep, tylersbray

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes the Runtime.NONE executor handling, which is a real part of the broader Docker availability and executor-skipping changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch no-docker-local-fixes/mck

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 29441/37449 78.6% 63.2%
Integration Tests 17383/36167 48.1% 20.6%

@mckornfield
mckornfield force-pushed the no-docker-local-fixes/mck branch from 2759ee3 to 6a95658 Compare July 30, 2026 19:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
services/core/jobs/src/nmp/core/jobs/controllers/backends/config.py (1)

140-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document Volcano filtering too.

_RUNTIME_NONE_UNSUPPORTED_BACKENDS also contains volcano_job, but this docstring names only Kubernetes. Explicitly mention both backends so the documented Runtime.NONE contract matches the implementation. (github.com)

Proposed wording
-    When runtime is NONE, Kubernetes-backed custom profiles are skipped. Docker custom profiles are skipped only when
+    When runtime is NONE, Kubernetes- and Volcano-backed custom profiles are skipped. Docker custom profiles are skipped only when
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/core/jobs/src/nmp/core/jobs/controllers/backends/config.py` around
lines 140 - 142, Update the docstring describing Runtime.NONE behavior near
_RUNTIME_NONE_UNSUPPORTED_BACKENDS to explicitly state that both Kubernetes and
Volcano-backed custom profiles are skipped, while preserving the existing Docker
availability behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@services/core/jobs/src/nmp/core/jobs/controllers/backends/config.py`:
- Around line 140-142: Update the docstring describing Runtime.NONE behavior
near _RUNTIME_NONE_UNSUPPORTED_BACKENDS to explicitly state that both Kubernetes
and Volcano-backed custom profiles are skipped, while preserving the existing
Docker availability behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 48d59dc6-10fe-4585-8aa8-43344e898208

📥 Commits

Reviewing files that changed from the base of the PR and between 6a95658 and 39cc845.

📒 Files selected for processing (2)
  • services/core/jobs/src/nmp/core/jobs/controllers/backends/config.py
  • services/core/jobs/tests/test_config.py

@mckornfield
mckornfield requested a review from tylersbray July 31, 2026 17:33
@tylersbray

Copy link
Copy Markdown
Contributor

Takeover notes (capability soft-skip reshape)

Took over this PR while @mckornfield is OOO and reshaped it away from blanketing all deployments executors under Runtime.NONE.

What changed vs the original approach

  • Deployments: DockerDeploymentBackend raises MissingBackendDependencyError when the daemon/socket is unavailable; the registry already soft-skips that. Skipped default_executor is cleared with a warning instead of failing startup. Openshell and other non-Docker executors remain.
  • Jobs: Docker profiles are skipped whenever Docker is unavailable (not only under Runtime.NONE). BackendRegistry.from_config also soft-skips Docker construction failures, then syncs the shared profiles list so /v2/execution-profiles matches what can actually run.
  • Setup UX: _wait_for_platform fails immediately if the service process exits (no full timeout hang), and prints an explicit Docker hint when the daemon is missing.

Still out of scope (follow-up)

Runtime removal / unified capability framework (Ryan’s longer-term point). This PR is a tactical fix for NVBug 6537617 that does capability detection at backend registration rather than treating Runtime as “has Docker.”

Please re-review when convenient.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/nemo_platform_ext/tests/cli/commands/test_setup.py (1)

768-775: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert that the launched process reaches the polling helper.

This test replaces _wait_for_platform with a stub. It does not catch a regression that removes proc=proc from the call site. Assert that the mock receives proc=dead.

Suggested assertion
-            patch(f"{SETUP_MOD}._wait_for_platform", return_value=False),
+            patch(f"{SETUP_MOD}._wait_for_platform", return_value=False) as mock_wait,
...
+        mock_wait.assert_called_once()
+        assert mock_wait.call_args.kwargs["proc"] is dead
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nemo_platform_ext/tests/cli/commands/test_setup.py` around lines 768
- 775, Update the test around _maybe_start_services to retain a mock for
_wait_for_platform and assert it is called with proc=dead. Keep the existing
ClickExit expectation and setup unchanged while verifying the launched process
is passed to the polling helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/setup.py`:
- Around line 956-960: Update the Docker availability check around
validate_docker_available() so it cannot block for the Docker SDK’s default
60-second timeout when DOCKER_HOST is unreachable. Pass a short explicit timeout
through docker.from_env(), or bypass this probe after _wait_for_platform()
fails, while preserving the existing unavailable-Docker message.

In `@services/core/jobs/src/nmp/core/jobs/controllers/backends/registry.py`:
- Around line 141-152: Update the exception handling around backend construction
in the registry initialization block to catch only the project’s
Docker-unavailability exception, matching the distinction used by the Nemo
deployments registry. Preserve the existing warning-and-skip behavior for that
exception, while allowing configuration, validation, and other unexpected errors
from backend(...) to propagate normally.

---

Nitpick comments:
In `@packages/nemo_platform_ext/tests/cli/commands/test_setup.py`:
- Around line 768-775: Update the test around _maybe_start_services to retain a
mock for _wait_for_platform and assert it is called with proc=dead. Keep the
existing ClickExit expectation and setup unchanged while verifying the launched
process is passed to the polling helper.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b0ecb4b3-a08a-4808-a079-81344cfedf8f

📥 Commits

Reviewing files that changed from the base of the PR and between 39cc845 and ca7beec.

⛔ Files ignored due to path filters (2)
  • sdk/python/nemo-platform/src/nemo_platform/cli/commands/setup.py is excluded by !sdk/**
  • sdk/python/nemo-platform/tests/vendored/nemo_platform_ext/cli/commands/test_setup.py is excluded by !sdk/**
📒 Files selected for processing (11)
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/setup.py
  • packages/nemo_platform_ext/tests/cli/commands/test_setup.py
  • plugins/nemo-deployments/src/nemo_deployments_plugin/backends/base.py
  • plugins/nemo-deployments/src/nemo_deployments_plugin/backends/docker/backend.py
  • plugins/nemo-deployments/src/nemo_deployments_plugin/backends/registry.py
  • plugins/nemo-deployments/tests/unit/backends/docker/test_backend_mocked.py
  • plugins/nemo-deployments/tests/unit/test_registry.py
  • services/core/jobs/src/nmp/core/jobs/controllers/backends/config.py
  • services/core/jobs/src/nmp/core/jobs/controllers/backends/registry.py
  • services/core/jobs/src/nmp/core/jobs/controllers/main.py
  • services/core/jobs/tests/test_config.py

Comment thread packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/setup.py Outdated
@tylersbray

Copy link
Copy Markdown
Contributor

Follow-on coherence patches (post gap review)

  • Jobs registry: soft-skip only on Docker/daemon connection errors (DockerException, RequestsConnectionError, Timeout, OSError); ValidationError / programming errors still raise.
  • validate_docker_available: also catches RequestsConnectionError + OSError (aligned with jobs).
  • Setup Docker hint: only when early exit and evidence (services.log soft-skip/daemon markers, or daemon probe false)—not on readiness timeout while the process is still alive without Docker evidence.
  • Tests: construction soft-skip vs fatal config error, advertised-profile sync prune, validate_docker catch set, setup proc= + hint gating.

Longer-term work (shared capability probe / Runtime shrink) tracked in AIRE Core Linear tickets — links coming shortly.

@tylersbray

Copy link
Copy Markdown
Contributor

Follow-up Linear tickets (AIRE Core)

  • Tier 2 (Medium): AIRCORE-971 — Unify backend capability detection; stop using Runtime as a proxy
  • Tier 3 (Low, blocked by Tier 2): AIRCORE-972 — Shrink or remove platform Runtime; capability-driven executor selection

Please leave design feedback on those tickets before implementation.

@tylersbray
tylersbray force-pushed the no-docker-local-fixes/mck branch from 545c0de to e8ff6c4 Compare July 31, 2026 21:12
mckornfield and others added 9 commits July 31, 2026 15:24
Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>
Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>
Skip Docker backends when the daemon is unreachable instead of
blanketing all executors under Runtime.NONE, and clear a skipped
default_executor so the deployments service can still boot.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
Filter Docker executor profiles whenever Docker is unavailable, not
only under Runtime.NONE, and skip Docker backend construction in the
jobs registry so local startup survives a missing daemon.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
Poll the service process during readiness wait so missing Docker no
longer burns the full timeout, and surface an explicit Docker hint
when the daemon is unavailable.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
Align DockerDeploymentBackend soft-skip with validate_docker_available
by also mapping request timeouts to MissingBackendDependencyError.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
After BackendRegistry skips unavailable Docker backends, prune the
shared profiles list so /v2/execution-profiles matches what can run.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
Narrow jobs Docker construction soft-skip to daemon/connection errors so
ValidationError still fails, align validate_docker_available catch set,
and only print the setup Docker hint when early exit or log evidence
points at Docker.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
Signed-off-by: Tyler Bray <tbray@nvidia.com>
@tylersbray
tylersbray force-pushed the no-docker-local-fixes/mck branch from e8ff6c4 to f4579fc Compare July 31, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants