-
Notifications
You must be signed in to change notification settings - Fork 19
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
RHOAIENG-3458: Introduce edge client and model registry client #234
RHOAIENG-3458: Introduce edge client and model registry client #234
Conversation
Running odh command without any subcommands should show the help message and not execute any functionality. The listing of namespaces was only added as a test. Make the root command not runnable and remove the unecessary test.
@devguyio: This pull request references RHOAIENG-3458 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@devguyio: This pull request references RHOAIENG-3458 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@devguyio: This pull request references RHOAIENG-3458 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@biswassri FYI |
Can we have an Readme containing instructions to build and run the cli, also list of available commands and its syntax? it will be easy for others to try it out. wdyt? |
/lint |
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.
@grdryn: 54 warnings.
In response to this:
/lint
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
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.
Is the JIRA ID correct in the title? It appears to reference a closed issue RHOAIENG-3458
cli/pkg/modelregistry/client.go
Outdated
return nil, fmt.Errorf("error creating model version: %w", err) | ||
} else { | ||
if resp.StatusCode != 201 { | ||
// TODO: Remove this workaround when model registry returns 404 when the model is not found |
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.
Is there an issue that can be linked for this?
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 you mean linked in the source code?
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.
Yeah, possibly. I think linking issues in the source code is useful, so that when we stumble across this TODO in future, we'll have concrete places to look to see if it can be progressed.
One drawback of this approach is that I don't seem to be able to leave inline suggestions as easily on all files; and also I don't seem to be able to mark all files as viewed, although I can for some (I presume if a file is changed in more than one commit in the PR, it can't be marked as viewed in any single one of those). |
/remove-approve (new process) |
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 should also include this in the Makefile and in the PR check as well under the make test
target.
142d095
to
9738cec
Compare
/lint |
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.
@devguyio: 4 warnings.
In response to this:
/lint
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
9738cec
to
e9ede5b
Compare
/lint |
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.
@devguyio: 0 warnings.
In response to this:
/lint
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
@Sara4994 I added a readme. |
This PR looks good to me, leaving this to Gerard and Landon now :) |
Holding for other reviewers /hold |
And @MarianMacik |
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.
/lgtm
/unhold |
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 just a few more comments. Nothing blocking, though. Thanks for all the changes, the code looks even better now!
cli/examples/params.yaml.sample
Outdated
- name: testDataConfigMapName | ||
value: CONFIG_MAP_NAME | ||
# Whether to add a workspace directory to the pipeline. Can be set to "true" or "false" | ||
- name: addDirWorkspace | ||
value: "true" |
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 are still present but as you said they are not used for this change, so maybe it would be better to remove these from this PR?
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.
Done.
cli/pkg/commands/common/cmd.go
Outdated
for _, f := range flags { | ||
if !f.IsRootFlag() { | ||
if f.IsInherited() { | ||
cmd.PersistentFlags().StringP(f.String(), f.Shorthand(), f.Value(), f.Usage()) | ||
} else { | ||
cmd.Flags().StringP(f.String(), f.Shorthand(), f.Value(), f.Usage()) | ||
} | ||
} | ||
} |
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'm not a cobra expert, but with the model add command we are inheriting the FlagModelRegistryURL
param from the root command. Here we are defining it again as a persistent flag even though it is not needed. If it works, then I'm fine with it. However, maybe we could register "new" flags here only if it is not a root flag AND it is not inherited. I am guessing this would be the right way to do it.
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.
Here we're registering non-root flags only. Root flags are registered in pkg/commands/root.go
. The FlagsModelRegistryURL
is a root flag as declared in pkg/commands/flags/flags.go
.
One logical error that I just fixed, is that root flags should also be set as inherited. I pushed a fix. It wasn't producing a bug but it was logically incorrect.
A root flag means it's defined at the root level, so can be inherited by all subcommands.
There can be a case of an inherited flag that's not root. In that case, it's defined by a specific sub-command and will be inherited by all of its nested sub-commands.
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.
@devguyio I see, I didn't realize that it is a root flag :)
However, in case of an inherited flag that is not root, if we add the third layer of commands, such a flag will be re-added at the third layer to the persistent flags, right? Because it will need to be listed among the flags to read and because it is the same slice, it will be iterated over when registering as well.
Right now it is not an issue as everything non-root should be registered. Also, maybe it won't be an issue even afterwards because cobra maybe can handle it.
38f8c04
to
66fb903
Compare
cli/pkg/commands/common/cmd.go
Outdated
for _, f := range flags { | ||
if !f.IsRootFlag() { | ||
if f.IsInherited() { | ||
cmd.PersistentFlags().StringP(f.String(), f.Shorthand(), f.Value(), f.Usage()) | ||
} else { | ||
cmd.Flags().StringP(f.String(), f.Shorthand(), f.Value(), f.Usage()) | ||
} | ||
} | ||
} |
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.
@devguyio I see, I didn't realize that it is a root flag :)
However, in case of an inherited flag that is not root, if we add the third layer of commands, such a flag will be re-added at the third layer to the persistent flags, right? Because it will need to be listed among the flags to read and because it is the same slice, it will be iterated over when registering as well.
Right now it is not an issue as everything non-root should be registered. Also, maybe it won't be an issue even afterwards because cobra maybe can handle it.
@devguyio I meant to include cli tests under the root makefile test target. |
25ddb80
to
b3d2259
Compare
@MarianMacik I've pushed the following changes:
|
Using the introduced edge client, refactor the model command to simply use the edge client for listing and adding models. Also refactor the commands design to streamline the flags and commands initialization.
b3d2259
to
0e2569d
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.
Nice catch with that bug, thanks for incorporating my comments!
/lgtm
/override ci/prow/test-ai-edge |
@devguyio: Overrode contexts on behalf of devguyio: ci/prow/test-ai-edge In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grdryn 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 |
Description
Using the model registry to implement the edge use case includes a lot of custom logic.
This PR adds a model registry client and an edge client as two abstractions that encapsulate such logic and can be used by the CLI directly.
This PR also refactors the models command to use the newly introduced edge client and streamlines the command design.
Tip
This PR is reviewed best commit-by-commit. Instead of using the
Files changed
tab:Commits
tabn
andp
to go to the next and previous commits respectively to review each commit.How Has This Been Tested?
cd cli make cli-build ./odh models
Merge criteria: