Skip to content

Commit

Permalink
Add the runtime_ref to the list_jobs() API
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
  • Loading branch information
andreyvelich committed Nov 15, 2024
1 parent b09a393 commit ee57831
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sdk_v2/kubeflow/training/api/training_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def train(

return train_job_name

def list_jobs(self) -> List[types.TrainJob]:
def list_jobs(self, runtime_ref: Optional[str] = None) -> List[types.TrainJob]:
"""List of all TrainJobs.
Returns:
Expand All @@ -268,6 +268,12 @@ def list_jobs(self) -> List[types.TrainJob]:
response = thread.get(constants.DEFAULT_TIMEOUT)

for item in response["items"]:
# If runtime ref is set, we check the TrainJob's runtime.
if (
runtime_ref is not None
and item["spec"]["runtimeRef"]["name"] != runtime_ref
):
continue
trainjob = self.api_client.deserialize(
utils.FakeResponse(item),
models.KubeflowOrgV2alpha1TrainJob,
Expand Down

0 comments on commit ee57831

Please sign in to comment.