Skip to content

[RayJob] Discuss pre-running deadline semantics for InteractiveMode Waiting #5193

Description

@OneSizeFitsQuorum

Search before asking

KubeRay Component

ray-operator

Description

We should discuss the deadline semantics for an InteractiveMode RayJob waiting for the user to provide spec.jobId.

The requirement is behavioral, not a predetermined API shape:

After the RayCluster becomes Ready and the RayJob enters Waiting, allow a configured amount of time for spec.jobId to be provided. Resource queueing and RayCluster startup must not consume this Waiting window. If no job ID is provided before the deadline, fail the RayJob with a clear reason and use the normal terminal cleanup path.

This issue intentionally does not assume that adding a field is necessarily the right solution. We should decide whether the existing field should change, whether deadlines should be split, or whether another API shape is preferable.

Current behavior on master

As of feeaf72facab4881ba2b179248bb67315634e229 (2026-08-19):

  • ray-operator/apis/ray/v1/rayjob_types.go:283-290 documents preRunningDeadlineSeconds as starting from status.startTime and covering both Initializing and Waiting.
  • ray-operator/controllers/ray/rayjob_controller.go:885-917 sets status.startTime during New to Initializing.
  • rayjob_controller.go:175-225 checks the same deadline in Initializing before RayCluster readiness, and lines 237-249 check it again in Waiting.
  • rayjob_controller.go:1247-1261 always calculates the deadline from status.startTime.

Therefore an InteractiveMode RayJob can reach Waiting with part or all of its configured budget consumed by scheduling and cluster startup. This differs from measuring how long the user has failed to complete the InteractiveMode handoff.

API questions to discuss

Possible directions include, but are not limited to:

  1. Change the existing field semantics for InteractiveMode so preRunningDeadlineSeconds starts when it enters Waiting, while retaining initialization-based behavior for other modes. This avoids another field but gives one field mode-dependent meanings.
  2. Keep the current broad field and add a Waiting-only field. This is backward compatible but increases API surface and overlapping deadlines.
  3. Replace or deprecate the combined field in favor of phase-specific deadlines, such as separate Initializing and Waiting deadlines. This is clearer but needs migration and versioning.
  4. Redefine the existing field as Waiting-only and provide a different mechanism for Initializing. This best matches the original [Feature] RayJob with Waiting status needs a ttl mechanism #4037 request but changes the behavior added for [Feature] RayJob with Initializing status needs a ttl mechanism #4178.

Questions for maintainers:

  • Are Initializing and Waiting one pre-running phase with a shared budget, or distinct phases needing independent budgets?
  • Is a submission-mode-dependent start point acceptable for preRunningDeadlineSeconds?
  • If deadlines are split, should the current field remain, be deprecated, or be replaced?
  • How should configurations containing both broad and phase-specific deadlines behave?
  • What transition timestamp should be persisted so the timer survives reconciliation and operator restarts?

Invariants regardless of API shape

  • The requested Waiting budget starts when the ready RayCluster causes the RayJob to enter JobDeploymentStatusWaiting, not at initial RayJob initialization.
  • It applies only while spec.jobId remains empty. If the ID is present when reconciling, use the real ID rather than fail or synthesize another one.
  • On timeout, set status.jobDeploymentStatus: Failed, use a dedicated reason and clear message, and do not fabricate status.jobId or status.jobStatus.
  • Reuse the existing terminal path for status.endTime, deletion rules, TTL, and shutdownAfterJobFinishes; do not add separate RayCluster deletion logic.

Use case

We create an InteractiveMode RayJob, wait for its RayCluster to become usable, submit the real business job externally, and write that submission ID to spec.jobId. If the external handoff never happens, the RayCluster should eventually be released. The user needs the full configured handoff window after readiness; variable scheduling and startup latency should not consume it.

Using an HTTPMode placeholder or monitor is not equivalent. Non-Interactive modes assign the submitted placeholder ID to status.jobId, and the controller copies that Ray job status into status.jobStatus. Those fields would describe the monitor rather than the real business job.

Related issues

Are you willing to submit a PR?

  • Yes, after the API semantics are agreed upon.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions