Skip to content

trainer: Update the get_job_logs() API#4198

Merged
google-oss-prow[bot] merged 2 commits into
kubeflow:masterfrom
andreyvelich:trainer-get-job-logs
Sep 4, 2025
Merged

trainer: Update the get_job_logs() API#4198
google-oss-prow[bot] merged 2 commits into
kubeflow:masterfrom
andreyvelich:trainer-get-job-logs

Conversation

@andreyvelich

Copy link
Copy Markdown
Member

Part of: kubeflow/sdk#75

We should update the get_job_logs() API in Trainer SDK.

/assign @kubeflow/kubeflow-trainer-team @kubeflow/kubeflow-sdk-team

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
@google-oss-prow google-oss-prow Bot added the area/trainer AREA: Kubeflow Trainer / Kubeflow Training Operator label Sep 3, 2025

log_dict = client.get_job_logs(job_name, step=constants.DATASET_INITIALIZER)
print(log_dict[constants.DATASET_INITIALIZER])
print("\n".join(client.get_job_logs(job_name, step=constants.DATASET_INITIALIZER)))

@kramaranya kramaranya Sep 3, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not this way?

for logline in TrainerClient().get_job_logs(job_id, step=constants.DATASET_INITIALIZER, follow=True):",
    print(logline)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will also work. I just try to show users different ways to print the logs.
In this doc, we just print logs without follow=True.

@kramaranya kramaranya Sep 3, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we should show different ways :) however on the website we only show examples with a string
Maybe on the getting started page we could add a note that you can use follow=True?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, let me change the getting started example.

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
@kramaranya

Copy link
Copy Markdown
Contributor

/lgtm
Thank you!

@andreyvelich andreyvelich left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andreyvelich

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
google-oss-prow Bot merged commit 498691a into kubeflow:master Sep 4, 2025
7 checks passed
@andreyvelich
andreyvelich deleted the trainer-get-job-logs branch September 4, 2025 14:45
aniketpati1121 pushed a commit to aniketpati1121/kubeflow-website that referenced this pull request Sep 23, 2025
* trainer: Update the get_job_logs() API

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

* Use follow=True for getting started example

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

---------

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
ederign pushed a commit to ederign/website that referenced this pull request Feb 2, 2026
* trainer: Update the get_job_logs() API

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

* Use follow=True for getting started example

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

---------

Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved area/trainer AREA: Kubeflow Trainer / Kubeflow Training Operator lgtm size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants