Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK] test: add unit test for list_jobs method of the training_client #2267

Merged

Conversation

seanlaii
Copy link
Contributor

@seanlaii seanlaii commented Sep 23, 2024

What this PR does / why we need it:
New unit test for list_jobs function

To verify run:

pytest -v sdk/python/kubeflow/training/api/training_client_test.py -k test_list_jobs

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):
Ref: #2161

Checklist:

  • Docs included if any changes are user facing

@coveralls
Copy link

coveralls commented Sep 23, 2024

Pull Request Test Coverage Report for Build 11155962731

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 11114598546: 0.0%
Covered Lines: 66
Relevant Lines: 66

💛 - Coveralls

@andreyvelich
Copy link
Member

@seanlaii Please rebase your PR.

@seanlaii seanlaii force-pushed the unit_test-TrainingClient-list_jobs branch from 7b04d0a to 522e8d9 Compare September 30, 2024 23:13
@seanlaii
Copy link
Contributor Author

@seanlaii Please rebase your PR.

Rebased. Please help take a look. Thank you.

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thank you for this @seanlaii!
I left a few comments.
/cc @kubeflow/wg-training-leads @Electronic-Waste

TimeoutError,
),
(
"invalid flow with runtime error",
Copy link
Member

Choose a reason for hiding this comment

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

Do you check this test case here: runtime error case ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Let me remove it.

Comment on lines 74 to 76
if args[2] == "timeout":
raise multiprocessing.TimeoutError()
elif args[2] == "runtime":
Copy link
Member

Choose a reason for hiding this comment

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

Please can you use constants here:

TIMEOUT = "timeout"
RUNTIME = "runtime"
.

Additionally, we can change them here:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Added.

@google-oss-prow google-oss-prow bot requested review from Electronic-Waste and a team October 1, 2024 14:23
@seanlaii seanlaii force-pushed the unit_test-TrainingClient-list_jobs branch 4 times, most recently from 4d8f77e to c3f087c Compare October 2, 2024 00:24
print("Executing test: ", test_name)

try:
training_client.list_jobs(**kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

Additionally, should we also verify the output of the list function, similar to how we verify output for get_job_pods API: https://github.com/kubeflow/training-operator/blob/c3f087c22e95fbe9082a5fd9b90117f1f115f800/sdk/python/kubeflow/training/api/training_client_test.py#L298C9-L298C22 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks for the suggestion! I should test the output as well. Please help review when you are available.

@seanlaii seanlaii force-pushed the unit_test-TrainingClient-list_jobs branch from c3f087c to 9f07ba8 Compare October 3, 2024 04:38
@google-oss-prow google-oss-prow bot added size/L and removed size/M labels Oct 3, 2024
@andreyvelich
Copy link
Member

Thanks for the update @seanlaii!
/lgtm
/approve

Copy link

[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

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 cbd4ae7 into kubeflow:master Oct 3, 2024
40 checks passed
@seanlaii seanlaii deleted the unit_test-TrainingClient-list_jobs branch October 3, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants