-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
What you would like to be added?
When running trainer.get_job_logs(job_id, follow=True), currently if the relevant pod does not exist, or is pending, the function exits without returning anything. Instead when follow=true, it would be good to wait for the pod to be running (potentially with some timeout)
sdk/kubeflow/trainer/backends/kubernetes/backend.py
Lines 330 to 344 in 53e744e
| def get_job_logs( | |
| self, | |
| name: str, | |
| follow: bool = False, | |
| step: str = constants.NODE + "-0", | |
| ) -> Iterator[str]: | |
| """Get the TrainJob logs""" | |
| # Get the TrainJob Pod name. | |
| pod_name = None | |
| for c in self.get_job(name).steps: | |
| if c.status != constants.POD_PENDING and c.name == step: | |
| pod_name = c.pod_name | |
| break | |
| if pod_name is None: | |
| return |
Why is this needed?
When follow=False, the user expects an empty response if no pod logs exist, but a common use case for follow=True is to watch a job immediately after submitting it, in this case the pods are unlikely to exist, meaning with the current behaviour the user must implement their own logic to wait for the pod.
Love this feature?
Give it a 👍 We prioritize the features with most 👍
Reactions are currently unavailable