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

RHOAIENG-3458: Add a models command to the CLI #227

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

devguyio
Copy link
Contributor

@devguyio devguyio commented Mar 13, 2024

Description

Add a models command that lists registered models from the model registry.

This PR is stacked on top of #222 .

How Has This Been Tested?

  • Install models registry in your kubecluster following this video
  • Port-forward port 8080 of the modelregistry-sample service in the namespace where you installed the model registry
kubectl port-forward services/modelregistry-sample 8080
  • From the cli directory, run the cli using go, the URL of the model registry is set via the env var MODEL_REGISTRY_URL which defaults to http://localhost:8080 .
cd cli
go run cmd/main.go

image

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 13, 2024

@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:

Description

Add a models command that lists registered models from the model registry.

This PR is stacked on top of #222 .

How Has This Been Tested?

  • Install models registry in your kubecluster following this video
  • Port-forward port 8080 of the modelregistry-sample service in the namespace where you installed the model registry
kubectl port-forward services/modelregistry-sample 8080
  • From the cli directory, run the cli using go, the URL of the model registry is set via the env var MODEL_REGISTRY_URL which defaults to http://localhost:8080 .
cd cli
go run cmd/main.go

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

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
Copy link
Contributor Author

/assign @StevenTobin @LaVLaS

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 13, 2024

@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:

Description

Add a models command that lists registered models from the model registry.

This PR is stacked on top of #222 .

How Has This Been Tested?

  • Install models registry in your kubecluster following this video
  • Port-forward port 8080 of the modelregistry-sample service in the namespace where you installed the model registry
kubectl port-forward services/modelregistry-sample 8080
  • From the cli directory, run the cli using go, the URL of the model registry is set via the env var MODEL_REGISTRY_URL which defaults to http://localhost:8080 .
cd cli
go run cmd/main.go

image

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

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.

Copy link

openshift-ci bot commented Mar 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: devguyio, Sara4994

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

@openshift-merge-bot openshift-merge-bot bot merged commit 9b74fea into opendatahub-io:main Mar 18, 2024
2 checks passed
Copy link
Member

@MarianMacik MarianMacik left a comment

Choose a reason for hiding this comment

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

Looks good, I have just one question about the currently unused fields of the model.

Comment on lines +75 to +76
cursor int
choices int
Copy link
Member

Choose a reason for hiding this comment

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

@devguyio I noticed that these are not used. Are they a preparation for the next step when a use will be able to choose a model and operate on it?

Copy link
Member

@grdryn grdryn left a comment

Choose a reason for hiding this comment

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

Feel free to disregard my Go-related comments, since I haven't used it in about 3 years probably, and have never used the bubbletea stuff 🙃

@@ -0,0 +1,163 @@
/*
Copyright 2023 KStreamer Authors
Copy link
Member

Choose a reason for hiding this comment

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

Is this copyright assignment correct? Just checking in case it's from some pre-existing default in your editor.

return errMsg{err}
}
if httpRes.StatusCode != 200 {
fmt.Printf("not 200: %d\n", httpRes.StatusCode)
Copy link
Member

Choose a reason for hiding this comment

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

Is this log message redundant, given the error message being returned? How does fmt.Printf get handled in the interactive text UI?

return registeredModelsMsg(models)
}

type model struct {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this would be better named more specifically to say that model here is a bubbletea concept, given that the file name (models.go) refers to AI models in a model registry? 😵‍💫

func (m model) View() string {
if m.err != nil {
return errorStyle.Render(fmt.Sprintf("Error: %s", m.err))
// return ""
Copy link
Member

Choose a reason for hiding this comment

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

This comment could probably be deleted

{Title: "Description", Width: 60},
}

rows := make([]table.Row, 0)
Copy link
Member

Choose a reason for hiding this comment

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

I guess the length 0 here could be more optimally set to len(m.registeredModelsList.Items)? That might have an impact on the code structure though, since the nil check from line 111 would have to encompass this too

os.Exit(1)
}
if m.(model).err != nil {
// cmd.PrintErrf("Error: %v\n", m.(model).err)
Copy link
Member

Choose a reason for hiding this comment

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

This commented code could probably be removed

@devguyio
Copy link
Contributor Author

@grdryn thanks for the review. This PR was merged by mistake and a lot of the comments you mentioned were addressed in #234 . Basically, the models command was refactored in #234 to use the edge client and also be ready for merge.

So I suggest that you check that PR and consider it the proposed state of the models command? wdyt?

@grdryn
Copy link
Member

grdryn commented Mar 25, 2024

Yeah, for sure, I plan to get around to looking at #234 soon too. I just figured that one would make more sense once I'd seen these earlier ones (that I know you'd mentioned had been merged accidentally).

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.

7 participants