• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubeflow / sdk / 20780172530

07 Jan 2026 11:36AM UTC coverage: 66.607% (-0.1%) from 66.736%
20780172530

push

github

web-flow
feat(trainer): add get_job_events API to retrieve TrainJob events (#220)

* feat(trainer): add get_job_events() API to retrieve TrainJob events

- Add Event dataclass to represent Kubernetes events with fields: involved_object_kind, involved_object_name, message, reason, event_time, first_occurrence, last_occurrence, count, and type
- Implement get_job_events() method in TrainerClient to provide users with visibility into TrainJob state changes and pod events
- Add abstract method get_job_events() to RuntimeBackend base class
- Implement get_job_events() for KubernetesBackend with proper event filtering and sorting
- Implement get_job_events() for LocalProcessBackend and ContainerBackend (return empty list as events are Kubernetes-specific)
- Add comprehensive unit tests for the new functionality

This addresses issue #196 by providing an API for users to check TrainJob events, giving additional clarity about the state when logs alone are insufficient.

Related-To: #196
Signed-off-by: Aditya Shirsatrao <adityashirsatrao007@gmail.com>

* Update kubeflow/trainer/backends/kubernetes/backend.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Aditya <adityashirsatrao007@gmail.com>

* Update kubeflow/trainer/backends/kubernetes/backend.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Aditya <adityashirsatrao007@gmail.com>

* fix: Error handling consistent

Signed-off-by: sksingh2005 <shashanksgh3@gmail.com>

* fix: Error handling consistent

Signed-off-by: sksingh2005 <shashanksgh3@gmail.com>

* Pre-commit test failure fix

Signed-off-by: sksingh2005 <shashanksgh3@gmail.com>

* Args for docstring in Event class

Signed-off-by: sksingh2005 <shashanksgh3@gmail.com>

* test mock events API and align timeout handling

Signed-off-by: sksingh2005 <shashanksgh3@gmail.com>

* only handle timeout error from the list_namespaced_event() API

Signed-off-by: sksingh2005 <shashanksgh3@gmail.com>
... (continued)

48 of 81 new or added lines in 7 files covered. (59.26%)

1 existing line in 1 file now uncovered.

2599 of 3902 relevant lines covered (66.61%)

1.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/kubeflow/optimizer/api/optimizer_client.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc