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

Add save models to registry setting of a model to CLI methods #2447

Conversation

avishniakov
Copy link
Contributor

@avishniakov avishniakov commented Feb 20, 2024

Describe changes

I added save models to registry setting of a model to CLI methods.

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • If my change requires a change to docs, I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.
  • If my changes require changes to the dashboard, these changes are communicated/requested.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

Summary by CodeRabbit

  • New Features

    • Introduced an option to control saving model artifacts to the registry directly from the CLI and client interfaces.
  • Tests

    • Enhanced CLI tests with a new flag to save models to the registry.
    • Improved test coverage to verify the new save_models_to_registry attribute functionality under various scenarios.

Copy link
Contributor

coderabbitai bot commented Feb 20, 2024

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The recent updates introduce a new feature allowing users to control whether model artifacts are saved to the registry. This is facilitated through the addition of a save_models_to_registry option in relevant functions and classes. The changes span across CLI functionalities, the client interface, and model management, including updates to integration tests to verify the new feature's behavior.

Changes

File(s) Summary
src/zenml/cli/model.py, src/zenml/client.py Introduced save_models_to_registry option in register_model and update_model functions to control saving of model artifacts to the registry. Updated _model_to_print to show save status.
src/zenml/models/v2/core/model.py Added save_models_to_registry boolean attribute to the ModelUpdate class.
tests/integration/functional/cli/test_model.py Added -s flag for saving models to the registry in CLI tests and updated tests for save_models_to_registry attribute behavior.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added the internal To filter out internal PRs and issues label Feb 20, 2024
@avishniakov avishniakov changed the base branch from main to develop February 20, 2024 08:41
@github-actions github-actions bot added the bug Something isn't working label Feb 20, 2024
@avishniakov
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 5ab2c47 and e752627.
Files selected for processing (4)
  • src/zenml/cli/model.py (8 hunks)
  • src/zenml/client.py (3 hunks)
  • src/zenml/models/v2/core/model.py (1 hunks)
  • tests/integration/functional/cli/test_model.py (6 hunks)
Additional comments: 9
src/zenml/models/v2/core/model.py (1)
  • 108-108: The addition of the save_models_to_registry attribute to the ModelUpdate class is a welcome change that supports the new feature's functionality. Ensure that this attribute is well-documented in the user-facing documentation to clarify its usage and implications.
tests/integration/functional/cli/test_model.py (3)
  • 62-69: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [65-80]

The addition of the -s flag in CLI tests to verify the save_models_to_registry attribute's behavior is well-implemented. It's important to ensure that these tests cover a wide range of scenarios to fully validate the feature's functionality.

  • 111-118: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [114-129]

The test for explicitly setting --save-models-to-registry to false is a good practice to verify that the feature can be disabled as expected. This helps ensure that users have full control over their model registration behavior.

  • 174-182: The update test that includes changing the save_models_to_registry attribute to false is crucial for ensuring that updates to existing models can correctly modify this setting. This test is well-placed and necessary for comprehensive coverage.
src/zenml/cli/model.py (2)
  • 202-226: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [191-206]

The handling of the save_models_to_registry parameter in the register_model function is correctly implemented. It's passed to the Client().create_model method after removing none values, which is a good practice to ensure that only provided values are sent to the backend. However, ensure that the backend (Client().create_model method) is prepared to handle this new parameter appropriately, including any necessary validation or default handling.

  • 335-342: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [322-354]

The handling of the save_models_to_registry parameter in the update_model function is consistent with the register_model function, which is good for maintaining code consistency. Again, ensure that the backend (Client().update_model method) is prepared to handle this new parameter appropriately. Additionally, it's important to verify that the update operation correctly applies this setting without unintended side effects on model artifacts already in the registry.

src/zenml/client.py (3)
  • 4748-4748: The addition of the save_models_to_registry parameter to the update_model method allows for controlling whether models should be saved to the registry during updates. This aligns with the PR's objective to enhance model management capabilities.
  • 4764-4765: The save_models_to_registry parameter is correctly added to the update_model method signature, enabling users to specify if model artifacts should be saved to the registry when updating models. This is a key feature introduced by the PR.
  • 4785-4785: The inclusion of save_models_to_registry in the ModelUpdate class instantiation within the update_model method is crucial for implementing the new feature. It ensures that the user's choice regarding saving models to the registry is respected during model updates.

src/zenml/cli/model.py Show resolved Hide resolved
src/zenml/cli/model.py Outdated Show resolved Hide resolved
src/zenml/cli/model.py Outdated Show resolved Hide resolved
Copy link
Contributor

@strickvl strickvl left a comment

Choose a reason for hiding this comment

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

LGTM, pending passing tests. You might also want to update the CLI docs with this option?

@avishniakov
Copy link
Contributor Author

LGTM, pending passing tests. You might also want to update the CLI docs with this option?

Thanks, not really - this feature is not yet having any effect, just a placeholder, so I would not advertise it more than needed (and needed is - not at all 🙂 )

@avishniakov avishniakov merged commit fef48c8 into develop Feb 21, 2024
61 checks passed
@avishniakov avishniakov deleted the bugfix/OSSK-347-save-models-to-registry-not-part-of-model-update-cli branch February 21, 2024 12:56
adtygan pushed a commit to adtygan/zenml that referenced this pull request Mar 21, 2024
…l-io#2447)

* Fix conditional statements in GitHub workflows (zenml-io#2404)

* Fix conditional statements in GitHub workflows

* rename core CI flows

* slow CI check doesn't happen when draft

* Auto-update of Starter template

* fix double conditional

---------

Co-authored-by: GitHub Actions <actions@github.com>

* Ensure proper spacing in error messages (zenml-io#2399)

* Ensure proper spacing in error messages

* update TOC (zenml-io#2406)

---------

Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>

* Fix hyperai markdown table (zenml-io#2426)

* build: ⬆️ Upgrade min required google-cloud-aiplatform to 1.34.0 (zenml-io#2428)

* Close code block left open in the docs (zenml-io#2432)

* Fix docs

* wrong ticks!

* Simplify HF example and notify when cache is down (zenml-io#2300)

* starter files for the new CI paradigm

* disable fast/slow ci on base branch

* disable core workflow

* Fast/slow CI core scaffold (zenml-io#2274)

* give darglint check its own job

* fastCI

* add slowCI

* reenable fast CI

* remove comment

* add integration tests

* fix spellcheck context

* enable slow CI for testing

* remove unit test dependency

* fix dependency installations

* yamlfixed

* Comment-driven CI (zenml-io#2275)

* test comment-driven approach

* delete unused test file

* slow CI is comment-driven

* restore CI

* conditionally respond to comments depending on team status

* add the whole team

* Update .github/workflows/ci-slow.yml

Co-authored-by: Andrei Vishniakov <31008759+avishniakov@users.noreply.github.com>

---------

Co-authored-by: Andrei Vishniakov <31008759+avishniakov@users.noreply.github.com>

* delete old CI

---------

Co-authored-by: Andrei Vishniakov <31008759+avishniakov@users.noreply.github.com>

* remove spellcheck from slow CI

* update spellcheck run conditions

* Add GitHub issue creation on cache miss

* test failing cache

* Update Minio endpoint in setup_environment action.yml

* Update minio-service endpoint in setup_environment action.yml

* Sharded integration tests for Ubuntu (zenml-io#2286)

* add pytest-shard dev dependency

* update script for sharded testing

* add ubuntu sharding

* fix naming

* Use `pytest-split` to shard CI (zenml-io#2296)

* add split test to action

* Update user authentication logic

* Fix bug in login functionality

* Refactor test coverage script

* Update excluded directories in pyproject.toml

* Update integration test script to include shard number

* Update integration test script to use matrix.shard

* Update caching key in setup_environment action.yml

* Update durations path in test-coverage-xml.sh

* Update cache key in setup_environment action.yml

* Auto-update of Starter template

* Fix formatting issue in setup_environment action.yml

* Refactor code to improve performance and readability

---------

Co-authored-by: GitHub Actions <actions@github.com>

* Update pyproject.toml

Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>

* add extra final line

* make workflows use normal ubuntu)

* fix durations path and update docstring

---------

Co-authored-by: Safoine El Khabich <34200873+safoinme@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>

* Auto-update of Starter template

* Auto-update of NLP template

* Auto-update of E2E template

* add docker testing back in

* Auto-update of E2E template

* temporarily trigger slow CI

* revert to comment-driven CI

* run full slow CI

* CI as it should be

* pyyaml fix

* fix docker compose installation

* test

* test

* update templates test

* ubuntu-unit tests

* restore unit tests back to normal

* fix matrix for slow CI

* uncomment the conditional checks

* add input variable

* remove mac and windows for testing

* split out slow and fast integration testing

* naming fix

* confirm mac and windows ok"

* improve hf and neuralprofet example

* update the issue

* update TOC (zenml-io#2406)

* Correct docstring in integration init file (zenml-io#2408)

* Fixed precedence

* adding the new version to the migration tests (zenml-io#2411)

* update js code for github cache miss

* update context to github

* add discord webhooks

* Add Discord webhook support for notifications

* allow fallback of cache failure

* ignore if weebhock fails to to many request

* Add PYTORCH integration to DockerSettings

---------

Co-authored-by: Alex Strick van Linschoten <stricksubscriptions@fastmail.fm>
Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>
Co-authored-by: Andrei Vishniakov <31008759+avishniakov@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Christian Versloot <c.versloot@infoplaza.nl>
Co-authored-by: Hamza Tahir <htahir111@gmail.com>
Co-authored-by: Barış Can Durak <36421093+bcdurak@users.noreply.github.com>

* Adding the latest version id and name to the artifact response (zenml-io#2430)

* update TOC (zenml-io#2406)

* Correct docstring in integration init file (zenml-io#2408)

* Fixed precedence

* adding the new version to the migration tests (zenml-io#2411)

* adding latest version name and id to artifact response

* removed optional column from the conftest

---------

Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>
Co-authored-by: Christian Versloot <c.versloot@infoplaza.nl>
Co-authored-by: Hamza Tahir <htahir111@gmail.com>

* Adding the ID of the producer pipeline run to artifact versions (zenml-io#2431)

* adding producer pipeline run id to artifact versions

* reverting one of the changes

* fixing type

* Add vulnerability notice to README (zenml-io#2437)

* Add security vulnerability notice to README

* add CVE ID

* Allow more recent `adlfs` and `s3fs` versions (zenml-io#2402)

* bump azure integration

* bump s3

* Add new property for filtering service account events (zenml-io#2405)

* add new property for filtering service account activities

* Auto-update of Starter template

---------

Co-authored-by: GitHub Actions <actions@github.com>

* Add `download_files` method for `ArtifactVersion` (zenml-io#2434)

* add save_binary method

* Fix file overwrite issue in save_artifact_binary_from_response() and improve error handling

* refactor

* tests ofc

* add docs

* linting

* mypy fixes

* ruff fix

* coderabbit suggestions

* missing docstring

* docstring fix

* Update artifact method name from save_binary to download_binary

* more renaming (save -> download)

* final rename (binary -> files)

* update settings syntax

* Fixing `update_model`s and revert zenml-io#2402 (zenml-io#2440)

* fixing update models

* reverting the update model changes

* linting

* linting

* revert zenml-io#2402

* revert adlfs changes

---------

Co-authored-by: Andrei Vishniakov <31008759+avishniakov@users.noreply.github.com>
Co-authored-by: Alex Strick van Linschoten <stricksubscriptions@fastmail.fm>

* Prepare release 0.55.3 (zenml-io#2445)

* alembic migration and bump version

* release notes

* add `save_models_to_registry` to CLI

---------

Co-authored-by: Alex Strick van Linschoten <strickvl@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Christian Versloot <c.versloot@infoplaza.nl>
Co-authored-by: François SERRA <francois.serra@adeo.com>
Co-authored-by: jlopezpena <jlopezpena@users.noreply.github.com>
Co-authored-by: Safoine El Khabich <34200873+safoinme@users.noreply.github.com>
Co-authored-by: Alex Strick van Linschoten <stricksubscriptions@fastmail.fm>
Co-authored-by: Hamza Tahir <htahir111@gmail.com>
Co-authored-by: Barış Can Durak <36421093+bcdurak@users.noreply.github.com>
Co-authored-by: Jayesh Sharma <wjayesh@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal To filter out internal PRs and issues run-slow-ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants