Skip to content

fix(optimizer): report Running from the Experiment Running condition - #893

Open
SahilKumar75 wants to merge 1 commit into
kubeflow:mainfrom
SahilKumar75:fix/optimizer-running-status
Open

SahilKumar75 wants to merge 1 commit into
kubeflow:mainfrom
SahilKumar75:fix/optimizer-running-status

Conversation

@SahilKumar75

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Right now the OptimizationJob status only becomes Running if one of the trial TrainJobs is running at the moment get_job() is called. The Experiment's own Running condition is never checked, so the status falls back to Created in two normal cases:

  • between trial batches, when the current trials have finished and Katib is creating the next ones
  • when trial pods are still pending (image pull, scheduling), so their TrainJobs are still Created

On a long experiment this makes the status go Created -> Running -> Created -> Running, and wait_for_job_status(status={"Running"}) can miss the short windows where a trial happens to be running.

Changes:

  • backend.py: in __get_optimization_job_from_cr, a Running=True condition on the Experiment now maps to OPTIMIZATION_JOB_RUNNING. The existing TrainJob check is still there as a fallback.
  • constants.py: added EXPERIMENT_RUNNING, next to EXPERIMENT_SUCCEEDED, and updated the comment on OPTIMIZATION_JOB_RUNNING.
  • backend_test.py: added two cases to test_get_job_status_conditions, both with Running=True on the Experiment: one where all trials are Complete and one where trials are still Created.

Succeeded and Failed handling is unchanged. Katib sets Running to False when the Experiment finishes, so a completed or failed job won't be reported as Running.

Testing:

  • the two new cases fail on main and pass with this change
  • uv run pytest kubeflow: 699 passed
  • make verify passes

Repro script from the issue: https://gist.github.com/SahilKumar75/9e37fc12cf6cebd299203b35e9dbcdbf

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):

Fixes #892

Checklist:

  • Docs included if any changes are user facing

get_job() and list_jobs() only reported Running when a trial TrainJob was
running at that moment, so between trial batches or while trial pods were
pending the status fell back to Created even though Katib reported the
Experiment as Running.

Fixes kubeflow#892

Signed-off-by: Sahil Kumar Singh <60318530+SahilKumar75@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 19:11
@github-project-automation github-project-automation Bot moved this to Ready to Merge in Kubeflow SDK Oct 21, 2026
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign andreyvelich for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

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

Labels

Projects

Status: Ready to Merge

Development

Successfully merging this pull request may close these issues.

OptimizationJob status shows Created while the Katib Experiment is running

2 participants