LocalProcessBackend.list_jobs() returns TrainJob objects with Unknown status instead of actual job status
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- backend, machine-learning
Research direction
Start by locating the LocalProcessBackend implementation and compare list_jobs() with get_job(), especially their TrainJob construction and use of __get_job_status(). Reproduce the case with a completed local job, then verify that list_jobs() reports the same status as get_job() for completed, failed, and running jobs.
Written by the indexing model from the issue text.
Description
What happened?
While looking through the LocalProcessBackend implementation, I noticed that list_jobs() and get_job() don't return consistent TrainJob objects.
get_job() calculates the job status using __get_job_status() before creating the TrainJob, but list_jobs() creates the same object without setting the status field.
Since TrainJob.status defaults to Unknown, every job returned by list_jobs() reports Unknown even if the underlying job has already completed, failed, or is running.
What did you expect to happen?
I expected list_jobs() to return the same status information as get_job(), since both APIs represent the same TrainJob.
How to reproduce
Looking at the implementation:
get_job() does:
status = self.__get_job_status(_job)
return types.TrainJob(
...
status=status,
)
But `list_jobs()` constructs the object without setting `status`:
types.TrainJob(
name=_job.name,
creation_timestamp=_job.created,
runtime=runtime,
num_nodes=1,
steps=[...],
)
I also reproduced this with a small unit test by creating a local job whose step status is `TRAINJOB_COMPLETE`. Calling `list_jobs()` still returns a `TrainJob` with `status == "Unknown"` instead of `"Complete"`.
**Why this matters**
This makes the behavior inconsistent between `list_jobs()` and `get_job()`. A caller using `list_jobs()` cannot rely on the returned status, even though the backend already has enough information to determine it.
### What did you expect to happen?
I expected list_jobs() to return the actual status of each TrainJob, consistent with get_job(). If a job has already completed, failed, or is running, list_jobs() should report that status instead of always returning Unknown.
### Environment
Kubernetes version:
```bash
$ 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 72/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