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

feat(backend): sort by run metrics - step 3. Part of #3591 #4251

Merged
merged 38 commits into from
Jul 31, 2020

Conversation

jingzhang36
Copy link
Contributor

@jingzhang36 jingzhang36 commented Jul 20, 2020

Description of your changes:

Part of #3591

Some refactoring to the existing listable interface and its implementors (i.e., various models of run, job, experiment, pipeline and pipeline version)

  1. Move all the model specific logic in list.go to the belonging models
  2. Prevent models depending on list.go but instead let list.go depends on models to avoid cyclic dependency, since list.go needs to call the implementors' method. As a result, two tests are moved from models to list_test.go
  3. Remove SortByFieldIsRunMetric field from list.go since it is model specific. Instead, we can listable object in token and hence determine the underlying model of the listable object.
  4. listable object as an interface needs special treatments for json.unmarshal, since json.unmarshal doesn't know about the underlying implemenator type of the listable interface. We used json.rawMessage to handle that
  5. Implement GetFieldValue (TODOs in step 2 feat(backend): sort by run metrics - step 2 #4235) and other methods declared in the listable interface for each implemenator model.

Checklist:

  • The title for your pull request (PR) should follow our title convention. Learn more about the pull request title convention used in this repository.

    PR titles examples:

    • fix(frontend): fixes empty page. Fixes #1234
      Use fix to indicate that this PR fixes a bug.
    • feat(backend): configurable service account. Fixes #1234, fixes #1235
      Use feat to indicate that this PR adds a new feature.
    • chore: set up changelog generation tools
      Use chore to indicate that this PR makes some changes that users don't need to know.
    • test: fix CI failure. Part of #1234
      Use part of to indicate that a PR is working on an issue, but shouldn't close the issue when merged.
  • Do you want this pull request (PR) cherry-picked into the current release branch?

    If yes, use one of the following options:

    • (Recommended.) Ask the PR approver to add the cherrypick-approved label to this PR. The release manager adds this PR to the release branch in a batch update.
    • After this PR is merged, create a cherry-pick PR to add these changes to the release branch. (For more information about creating a cherry-pick PR, see the Kubeflow Pipelines release guide.)

…page and the archive page"

This reverts commit 5b67273.
…ed at, etc. The lattre are direct field in listable object, the former is an element in an arrary-typed field in listable object. In other words, the latter are columns in table, the former is not.
@kubeflow-bot
Copy link

This change is Reviewable

@jingzhang36
Copy link
Contributor Author

jingzhang36 commented Jul 20, 2020

/assign @Bobgy
/assign @rmgogogo

@jingzhang36
Copy link
Contributor Author

test fixed.
/assign @Bobgy
/assign @rmgogogo

Copy link
Contributor

@Bobgy Bobgy left a comment

Choose a reason for hiding this comment

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

/lgtm
I don't have much ideas of other changes. Maybe it would be a good topic for introduction.

Comment on lines 66 to 73
// The listable model this token is applied to. Not used in json marshal/unmarshal.
Model Listable `json:"-"`
// ModelType and the ModelMessage are helper fields to unmarshal data correctly to
// the underlying listable model, and this underlying listable model will be stored
// in the above Model field. Those two fields are only used in token's marshal and
// unmarshal methods.
ModelType string
ModelMessage json.RawMessage
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can you comment example values of these fields?
That helps understanding these fields.

My initial confusion when reading this: Is it an ML model or a data model?

Copy link
Contributor Author

@jingzhang36 jingzhang36 Jul 30, 2020

Choose a reason for hiding this comment

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

Actually this is not about the ML terminology, but about a terminology used in backend implementation . We actually can get clues from the existing backend implementation. If we take a look at our code, there is a folder called backend/src/apiserver/model. In that folder, we have structs job, run, experiment, etc. In other words, the run, job, experiment, etc. are considered a type of "model". (I am not sure about the history here though). Moreover, all those models (aka, job, run, experiment, etc.) implement the "listable" interface. In other words, the set of jobs, (or runs, experiments) is listable.

So back to this struct token. Token is applied to a listable (aka a set of runs, jobs, experiments etc.). So, in the token, we can add this model field to indicate which model (aka, run, job, experiment) this token applies to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I add some explanation to this field, pointing to the folder. Hope that would help.

@k8s-ci-robot k8s-ci-robot removed the lgtm label Jul 30, 2020
@jingzhang36
Copy link
Contributor Author

jingzhang36 commented Jul 30, 2020

In my manual test in a real deployment, it turns out the "Model Listable" field has too large a data size when listing runs (other types are fine), since runs contain the complete manifest. Therefore, I replaced "Model Listable" with only relevant fields in Listable type.

/assign @Bobgy
/assign @rmgogogo

@jingzhang36
Copy link
Contributor Author

/test kubeflow-pipeline-e2e-test

@Bobgy Bobgy changed the title feat(backend): sort by run metrics - step 3 feat(backend): sort by run metrics - step 3. Part of #3591 Jul 31, 2020
@Bobgy
Copy link
Contributor

Bobgy commented Jul 31, 2020

/lgtm

@jingzhang36
Copy link
Contributor Author

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jingzhang36

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

@k8s-ci-robot k8s-ci-robot merged commit 9c6738f into kubeflow:master Jul 31, 2020
chensun pushed a commit to chensun/pipelines that referenced this pull request Aug 7, 2020
…ubeflow#4251)

* enable pagination when expanding experiment in both the home page and the archive page

* Revert "enable pagination when expanding experiment in both the home page and the archive page"

This reverts commit 5b67273.

* sorting by run metrics is different from sorting by name, uuid, created at, etc. The lattre are direct field in listable object, the former is an element in an arrary-typed field in listable object. In other words, the latter are columns in table, the former is not.

* unit test: add sorting on metrics with both asc and desc order

* GetFieldValue in all models

* fix unit test

* whether to test in list_test. It's hacky when check mode == 'run'

* move model specific code to model; prevent model package depends on list package; let list package depends on modelpackage; marshal/unmarshal listable interface; include listable interface in token.

* some assumption on token's Model field

* fix the regular field checking logic

* add comment to help devs to use the new field

* add a validation check

* Listable object can be too large to be in token. So replace it with only
relevant fields taken out of it. In the future, if more fields in
Listable object become relevant, manually add it to token

* matches func update
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
…ubeflow#4251)

* enable pagination when expanding experiment in both the home page and the archive page

* Revert "enable pagination when expanding experiment in both the home page and the archive page"

This reverts commit 5b67273.

* sorting by run metrics is different from sorting by name, uuid, created at, etc. The lattre are direct field in listable object, the former is an element in an arrary-typed field in listable object. In other words, the latter are columns in table, the former is not.

* unit test: add sorting on metrics with both asc and desc order

* GetFieldValue in all models

* fix unit test

* whether to test in list_test. It's hacky when check mode == 'run'

* move model specific code to model; prevent model package depends on list package; let list package depends on modelpackage; marshal/unmarshal listable interface; include listable interface in token.

* some assumption on token's Model field

* fix the regular field checking logic

* add comment to help devs to use the new field

* add a validation check

* Listable object can be too large to be in token. So replace it with only
relevant fields taken out of it. In the future, if more fields in
Listable object become relevant, manually add it to token

* matches func update
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.

5 participants