LocalProcessBackend.list_jobs() returns incorrect runtime metadata for unfiltered job listings
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in kubeflow/trainer/backends/localprocess/backend.py and compare list_jobs() with get_job(), focusing on how runtime is selected when no filter is passed. Verify that listed TrainJob objects expose each stored job’s runtime and remain consistent with get_job(); run or add focused tests if available.
Written by the indexing model from the issue text.
Description
What happened?
While reviewing the LocalProcessBackend, I compared the implementations of list_jobs() and get_job() to make sure both APIs return consistent job information.
During the review, I noticed that get_job() correctly returns the runtime stored inside each job by using:
runtime=_job.runtime,
However, list_jobs() behaves differently.
In kubeflow/trainer/backends/localprocess/backend.py, every TrainJob returned by list_jobs() is created using the method parameter:
runtime=runtime,
instead of the runtime that actually belongs to the job:
runtime=_job.runtime,
This becomes a problem when `list_jobs()` is called without a runtime filter, which is also the default behavior.
For example:
backend.list_jobs()
Since the runtime parameter is None, every returned TrainJob is populated with:
runtime=None
even though each job already has a valid runtime stored internally.
At the same time, requesting the exact same job through `get_job()` returns the correct runtime because it uses `_job.runtime`.
So the same job exposes different runtime information depending on which API is used. This makes the two APIs inconsistent and causes incorrect runtime metadata to be returned by `list_jobs()`.
Affected File**
kubeflow/trainer/backends/localprocess/backend.py
*Current Code**
result.append(
types.TrainJob(
name=_job.name,
creation_timestamp=_job.created,
runtime=runtime,
num_nodes=1,
steps=[...],
)
)
Expected Code
result.append(
types.TrainJob(
name=_job.name,
creation_timestamp=_job.created,
runtime=_job.runtime,
num_nodes=1,
steps=[...],
)
)
Why this matters
list_jobs() should always return the runtime associated with each stored job. Instead, it returns the runtime filter passed to the function. When no filter is supplied, every returned TrainJob contains runtime=None, even though the actual runtime exists. This results in inconsistent API behavior and incorrect metadata being returned to callers.
What did you expect to happen?
list_jobs() should always return each TrainJob with its actual associated runtime (_job.runtime), regardless of whether a runtime filter is provided. The returned runtime information should be consistent with get_job().
Environment
Kubernetes version:
$ kubectl version
Kubeflow Trainer version:
$ kubectl get pods -n kubeflow -l app.kubernetes.io/name=trainer -o jsonpath="{.items[*].spec.containers[*].image}"
Kubeflow Python SDK version:
$ pip show kubeflow
Impacted by this bug?
Give it a 👍 We prioritize the issues with most 👍
- Dominant language
- Python
- Stars
- 148
- Forks
- 263
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from kubeflow/sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
kind/bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
kind/bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
kind/bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
kind/feature needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100