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

Set up model registry context and apiHooks #360

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

lucferbux
Copy link
Contributor

@lucferbux lucferbux commented Sep 9, 2024

Description

This is a really big PR, added some views to test the context and apiHooks cause there were some issues that I couldn't test until we could hook them into views.

Model Registry Context

  • Two new contexts, one for switching between model registries and support federation and the other to load the API interface once we tap into the Model Registry

Api Hooks

  • Defined api hooks to support fetching from the defined API

Model Registry Empty View and MR Selector

  • Added Model Registry Selector Context to cover all the states fetching MR data before loading the main page
  • Adapted routes to support dynamic loading of contexts
  • Implemented the toolbar selector to change between Model Registries and support federation
Screenshot 2024-09-11 at 13 17 49 Screenshot 2024-09-11 at 13 17 57

How Has This Been Tested?

  • Added both unit testing for apiHooks, error states and other util functions.
  • Enhanced integration testing with the first page of model registry.
Screenshot 2024-09-11 at 13 23 12

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages; the author will squash them after approval or in case of manual merges will ask to merge with squash.
  • 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.
  • Code changes follow the kubeflow contribution guidelines.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

@lucferbux
Copy link
Contributor Author

Test are failing, I opened the PR cause I wanted to ask why it's not working as expected

@@ -17,7 +18,7 @@ const (
ModelRegistryId = "model_registry_id"
RegisteredModelId = "registered_model_id"
HealthCheckPath = PathPrefix + "/healthcheck"
ModelRegistry = PathPrefix + "/model-registry"
ModelRegistry = PathPrefix + "/model_registry"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexcreasy @ederign @Griffin-Sullivan I've just updated this enpoint cause it wasn't using the api specification and it was making the dev env to fail, I can leave this out of the PR if you guys wanna add it into other PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with this, but could you update the BFF readme so the examples are correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks a lot for the review!!

@@ -18,7 +18,6 @@ module.exports = merge(common('development'), {
host: HOST,
port: PORT,
historyApiFallback: true,
open: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just removed the auto open, we disabled it in other projects cause some people in the community tend to dislike it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks... auto open drives me nuts because I'm lame and use Safari as my default browser but like to develop in chrome :D

(opts: APIOptions): Promise<ModelRegistry> =>
handleRestFailures(restGET(hostPath, `/api/${BFF_API_VERSION}/model_registry`, {}, opts));
(opts: APIOptions): Promise<ModelRegistry[]> =>
handleRestFailures(restGET(hostPath, `/api/${BFF_API_VERSION}/model_registry`, {}, opts)).then(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just added here the conversion to make it easier to process in the rest of the dashboard.


export const createRegisteredModel =
(hostPath: string, mrName: string) =>
(hostPath: string) =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It made more sense passing most of the path as hostPath rather than parameters.

@@ -0,0 +1,32 @@
import * as React from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor of useApi for the proxy

Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

I'm fine with the changes. Lots going on here so can't give a super great review but tests are passing, it works for me locally, and I don't want to get held up on this when we have more things depending on it.

@@ -42,7 +42,7 @@ export const useAdminSettings = (): NavDataItem[] => {
export const useNavData = (): NavDataItem[] => [
{
label: 'Model Registry',
path: '/',
path: '/modelRegistry',
Copy link
Contributor

Choose a reason for hiding this comment

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

is it normal to do camel case for URLs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a valid point, im just porting midstream code but we can refactor in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, agree with Griffin, but no need to change right now.

Signed-off-by: lucferbux <[email protected]>
@alexcreasy
Copy link
Contributor

/lgtm

@alexcreasy
Copy link
Contributor

/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexcreasy, Griffin-Sullivan

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

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