-
Notifications
You must be signed in to change notification settings - Fork 458
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
Add unit test for create_experiment
in the katib_client
module
#2325
Add unit test for create_experiment
in the katib_client
module
#2325
Conversation
create_experiment
in the katib_client
module
1545807
to
2aacab9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for taking this @tariq-hasan and sorry for the late review!
I left a few comments.
import logging | ||
logging.basicConfig() | ||
log = logging.getLogger("kubeflow.katib.api.katib_client") | ||
log.setLevel(logging.DEBUG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this!
constants.KUBEFLOW_GROUP, | ||
constants.KATIB_VERSION, | ||
namespace, | ||
constants.EXPERIMENT_PLURAL, | ||
experiment, | ||
) | ||
experiment_name = outputs["metadata"][ | ||
"name" | ||
] # if "generate_name" is used, "name" gets a prefix from server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep that in case experiment is created using generate_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. My understanding of the code was not complete hence I removed it incorrectly. I have reverted this code change and updated the create_namespaced_custom_object_response
function to account for the output of the create_namespaced_custom_object
function.
"experiment": create_experiment(name="experiment-mnist-ci-test"), | ||
"namespace": "test", | ||
}, | ||
"success", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this string as constant ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a constant to replace "success"
.
"experiment": create_experiment( | ||
name="experiment-mnist-ci-test", | ||
generate_name="experiment-mnist-ci-test", | ||
), | ||
"namespace": "test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we pass generate_name and name how does Kubernetes Python client create the Experiment ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that name
is used when both name
and generate_name
are provided.
Ref: https://github.com/tariq-hasan/katib/blob/master/sdk/python/v1beta1/kubeflow/katib/api/katib_client.py#L102-L105.
Would you suggest making changes to this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These parameters are mutually exclusive. Users can set name
or generate_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I have removed the two test cases where both name
and generate_name
are specified.
logger.debug(f"Current Optimal Trial:\n {experiment.status.current_optimal_trial}") | ||
logger.debug(f"Experiment conditions:\n {experiment.status.conditions}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep print
here similar to get_job_logs API in Training Client: https://github.com/kubeflow/training-operator/blob/master/sdk/python/kubeflow/training/api/training_client.py#L1193 ?
Since when user runs this API, the SDK works like CLI and user wants to get output.
WDYT @droctothorpe @tariq-hasan @kubeflow/wg-automl-leads ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted the changes to keep print
.
Hi @tariq-hasan, do you have some time to finish this PR ? |
Hi @andreyvelich I will try to complete it this week. Sorry about the delay. |
c4e9bf4
to
4e963bc
Compare
Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
…ructor Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
2092eec
to
ab56bf9
Compare
ab56bf9
to
85dc9a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, only 1 comment from me @tariq-hasan.
/assign @johnugeorge @tenzen-y
@@ -56,3 +57,6 @@ | |||
BASE_IMAGE_MXNET = "docker.io/mxnet/python:1.9.1_native_py3" | |||
|
|||
DEFAULT_DB_MANAGER_ADDRESS = "katib-db-manager.kubeflow:6789" | |||
|
|||
# Test result constants | |||
TEST_RESULT_SUCCESS = "success" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep this variable in the katib_client_test.py
since we use it only in that file.
Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
887a69b
to
6dbea78
Compare
There was a problem hiding this 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 great contribution @tariq-hasan 🎉
/lgtm
/approve
[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 |
I suppose that the next step is to write unit test for the |
That's right @tariq-hasan. Please feel free to create an issue and assign it to yourself. Additionally, it would be nice to add e2e test for |
…ubeflow#2325) * added logger for katib_client module Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> * added API_VERSION as a constant Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> * updated the KatibClient constructor to match the TrainingClient constructor Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> * added test for create_experiment in katib_client Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> --------- Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
…ubeflow#2325) * added logger for katib_client module Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> * added API_VERSION as a constant Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> * updated the KatibClient constructor to match the TrainingClient constructor Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> * added test for create_experiment in katib_client Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com> --------- Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
What this PR does / why we need it:
create_experiment
function as part of this commit.tune
function once this is merged.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2184
Test Plan: The code for the Python tests has been verified as part of this CI workflow.
Checklist: