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

[Model WatchTower] Add ArtifactConfig (+OSS-2427) & model version management in context (partially) #1822

Conversation

avishniakov
Copy link
Contributor

@avishniakov avishniakov commented Sep 19, 2023

Describe changes

I implemented ArtifactConfig and overrides for Model Objects and Deployments to be used by users in Annotated objects of steps outputs.

To support this feature I also extended pipeline and step runners to:

  • Once steps enter context we create a new ModelVersion, if it was requested. It will be called zenml.constants. RUNNING_MODEL_VERSION. (see `zenml.orchestrators/step_runner.py::_prepare_model_context_for_step)
  • Once step is completed we link artifacts with valid annotation to a version, which was prepared (if needed) on enter
  • Once the pipeline is succeeded we register_running_versions giving them a valid version number (integer increments), so running will become 24, if 23 was the previous greatest.

I also extended a bit structure of ArtifactLinks to support versioned links using the same name (also auto-incremented integer).

Example of attachments:

@step
def a()->Tuple[Annotated[int,"1"],Annotated[int,"2",ArtifactConfig(model_name="artifact")]]:
    link_output_to_model(ArtifactConfig(model_name="manual"), output_name="1")
    return 1,2

@step
def b():
    link_output_to_model(ArtifactConfig(model_name="manual")
    return 1

@step
def c()->Annotated[int,"10"]:
    return 10

@step(enable_cache=False, model_config=ModelConfig(name="step"))
def d()->Annotated[int,"100"]:
    return 100

@pipeline(enable_cache=False, model_config=ModelConfig(name="pipe"))
def p():
    a()
    b()
    c()
    d()

if __name__=="__main__":
    p()

In the example above output artifacts will be linked to ModelVersions as follows:

  • "2" will get Model from artifact config => artifact
  • "1" is manually linked with link_output_to_model => manual
  • Output of b() is not named, but is linked manually => manual
  • "10" get implicit linking from pipeline => pipe
  • "100" get implicit linking from step => step

So Resolution Order is: ArtifactConfig/Manual>@step>@pipeline

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.
  • If I have added an integration, I have updated the integrations table and the corresponding website section.
  • 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.

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)

@avishniakov
Copy link
Contributor Author

@fa9r , CI passed well for me - there were some failures, but not related to this (addressed in Discord). Can you recheck my comments and approve/reject those?

Copy link
Contributor

@fa9r fa9r left a comment

Choose a reason for hiding this comment

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

LGTM let's get this merged 🙌

@@ -58,3 +61,23 @@ class ModelBaseModel(BaseModel):
tags: Optional[List[str]] = Field(
title="Tags associated with the model",
)


class ModelConfigModel(ModelBaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally I'd suggest looking into this again to figure out whether there's a cleaner solution to the circular import, but since it's the only open issue on this PR I'd also be fine with just merging it

@avishniakov avishniakov merged commit b47a718 into feature/OSS-2300-model-watch-tower-v0.1 Sep 26, 2023
3 of 19 checks passed
@avishniakov avishniakov deleted the feature/OSS-2423-add-artifact-config branch September 26, 2023 08:13
avishniakov added a commit that referenced this pull request Oct 10, 2023
* Implementation of Model table (#1802)

* [Model Watch Tower] Adding ModelVersion and ModelVersionLink entities (#1811)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* fix tests in docker

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

---------

Co-authored-by: Felix Altenberger <[email protected]>

* [Model Watch Tower] Implement `zenml.log_artifact_metadata()` (#1813)

* Delete dead code

* Implement zenml.log_artifact_metadata()

* Improve error handling and add tests

* Remove 'description' arg of log_artifact_metadata() and fix docstring

* Fix test name

* Remove TODOs

* Rewrite create_run_metadata() to make batch API requests

* Adjust unit tests

* Fix flaky test_is_secret_reference

* Fix integration tests

* [Model Watch Tower] Add ModelConfig (#1817)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* lint

* remove `ModelStages._members()`

* improve wording

* Union[str, ModelStages]

* simplify `get_model_version` to one endpoint

* remove `_get_request_params`

* split `_get_or_create_model_version`

* ensure `get_or_create_model` is stable

* add docstrings

* lint

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

---------

Co-authored-by: Felix Altenberger <[email protected]>

* lint

* [Model WatchTower] add ModelConfig to step and pipeline decorators (#1819)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add docstring

* cleaning up after merge

* move `ModelBaseModel` back to `models`

* direct imports

* breaking another circular dep

* and one more circular dep

---------

Co-authored-by: Felix Altenberger <[email protected]>

* [Model WatchTower] Add ArtifactConfig (+OSS-2427) & model version management in context (partially)  (#1822)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add artifact config and necessary registrations around it

* fix bug with `Output` annotation

* add docstring

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* cleaning up after merge

* move `ModelBaseModel` back to `models`

* direct imports

* breaking another circular dep

* clean-up after conflicts resolution

* and one more circular dep

* and one more circular dep

* update tests to include `OutputSignature`

* add `link_output_to_model`

* stabilize tests

* add implicit linkage

* more tests

* lint

* docstrings

* test/bug fixes

* extend artifact link key to pipe/step/name

* lint

* fix for 3.8

* fix failing test call signatures

* update_forward_refs centrally

* Update src/zenml/model/artifact_config.py

Co-authored-by: Felix Altenberger <[email protected]>

* Update src/zenml/zen_stores/sql_zen_store.py

Co-authored-by: Felix Altenberger <[email protected]>

* add a warning about not supported feature

* add arguments descriptions

* improve docstrings a bit

* assign_version_to_running internal + docs

* rename to link_version

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Felix Altenberger <[email protected]>

* rename arg in test

* lint

* refactor a bit

* address PR comment

* remove deleted classes

* Update src/zenml/models/model_base_model.py

Co-authored-by: Felix Altenberger <[email protected]>

* move `ModelStages` to enums

* merge `model_stage` and add tests for it

* simplify `_link_artifacts_to_model` args

* docstrings

* docstrings

* lint

* fix args in tests

* fix __mro__ test failure

* fix for mlflow test

* stabilize test_list_runs_is_ordered

* fix pagination in some tests

* address PR comments

---------

Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* [Model WatchTower] Delete running versions on failed pipelines with `delete_new_version_on_failure ` option (#1825)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add artifact config and necessary registrations around it

* fix bug with `Output` annotation

* add docstring

* delete running versions on fail

* add deletion test

* don't return running without recovery

* remove base_model.py

* PR comments

* remove merged migration

* PR comments

* improve model_config warnings

* clean up merge mess

* bandit is too strict

* typos

* clean up merge mess

* remove not relevant asserts

* improve docs

* improve docs

* rely on deployment in `get_new_version_requests`

* stabilize tests in random order

* improve docs

* stabilize tests

---------

Co-authored-by: Felix Altenberger <[email protected]>

* Fix OOM issue by disabling SkyPilot test

* [Model WatchTower] Extend `ExternalArtifact` (#1839)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add artifact config and necessary registrations around it

* fix bug with `Output` annotation

* add docstring

* delete running versions on fail

* add deletion test

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* cleaning up after merge

* move `ModelBaseModel` back to `models`

* direct imports

* breaking another circular dep

* clean-up after conflicts resolution

* and one more circular dep

* and one more circular dep

* update tests to include `OutputSignature`

* add `link_output_to_model`

* stabilize tests

* add implicit linkage

* more tests

* lint

* docstrings

* test/bug fixes

* extend artifact link key to pipe/step/name

* lint

* fix for 3.8

* fix failing test call signatures

* update_forward_refs centrally

* Update src/zenml/model/artifact_config.py

Co-authored-by: Felix Altenberger <[email protected]>

* Update src/zenml/zen_stores/sql_zen_store.py

Co-authored-by: Felix Altenberger <[email protected]>

* add a warning about not supported feature

* add arguments descriptions

* improve docstrings a bit

* assign_version_to_running internal + docs

* rename to link_version

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Felix Altenberger <[email protected]>

* rename arg in test

* lint

* refactor a bit

* address PR comment

* remove deleted classes

* Update src/zenml/models/model_base_model.py

Co-authored-by: Felix Altenberger <[email protected]>

* move `ModelStages` to enums

* merge `model_stage` and add tests for it

* simplify `_link_artifacts_to_model` args

* docstrings

* docstrings

* lint

* fix args in tests

* fix __mro__ test failure

* fix for mlflow test

* stabilize test_list_runs_is_ordered

* update .gitignore

* fix pagination in some tests

* don't return running without recovery

* remove base_model.py

* PR comments

* remove merged migration

* PR comments

* improve model_config warnings

* clean up merge mess

* external artifacts for model watchtower

* bandit is too strict

* typos

* clean up merge mess

* remove not relevant asserts

* improve docs

* improve docs

* rely on deployment in `get_new_version_requests`

* stabilize tests in random order

* improve docs

* use utils model_killer

* clean up merge mess

* use Annotated from typing_extensions

* one more circular dep case

* lint

* resolve alembic branching

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* get rid of `_testable_upload_if_necessary`

* refactor `upload_if_necessary`

* `zenml.artifacts.external_artifact.ExternalArtifact`

* add tests for getters of MV response

* improve docstring

* fix before  #1835

* lint

* remove  `_import_client`

* fixing issues highlighted by tests

* update docstrings

* fix year in license

* add docstrings

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/steps/external_artifact.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* fix docstrings

* Move UnmaterializedArtifact to zenml.artifacts

* add fix of path in docs

* split ExternalArtifact into user class and config for step

* update template working branch

* restrict pydantic

* Revert "restrict pydantic"

This reverts commit b94e01f.

---------

Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* [Model WatchTower] Extend client (#1849)

* extend client for Model WatchTower

* resolve alembic branching

* aligh template ref

* Auto-update of E2E template

* [Model WatchTower] link runs to model versions (#1847)

* linkage of pipeline runs

* add docstring

* tricky bug

* full linkage on consumption

* lint

* use client

* Auto-update of E2E template

* update outdated test

* create new version if any step touching it is executed and it was requested elsewhere

* refactor `_link_pipeline_run_to_model`

* add few more tests

---------

Co-authored-by: GitHub Actions <[email protected]>

* remove deepchecks tests from CI

* remove pytorch

* remove pytorch_lightning

* try tensorflow instead of pytorch

* formatting

* remove TF tests

* formatting

* try free ubuntu action

* refactor

* add skypilot back in

* install missing pkg and update tests

* add missing conditional to yaml

* with permissions

* add template release

* [Model Control Plane] parallel running versions support (#1859)

* linkage of pipeline runs

* add docstring

* tricky bug

* full linkage on consumption

* lint

* use client

* Auto-update of E2E template

* update outdated test

* create new version if any step touching it is executed and it was requested elsewhere

* refactor `_link_pipeline_run_to_model`

* add few more tests

* parallel execution of model versions

* add version number

* improve readability

* protect from misuse

* extend `ArtifactConfig.model_version`

* align model config docstrings

* stabilize parallelized test

* rework test as subprocess calls

* skip subprocess test on windows

* after merge mess

* update tests flow based on develop

* proper handle __latest__ mv in REST

* fix get model version endpoint

* simplify user-facing interface

* fix test annotation

---------

Co-authored-by: GitHub Actions <[email protected]>

* [Model Control Plane] Add CLI (#1861)

* linkage of pipeline runs

* add docstring

* tricky bug

* full linkage on consumption

* lint

* use client

* Auto-update of E2E template

* update outdated test

* create new version if any step touching it is executed and it was requested elsewhere

* refactor `_link_pipeline_run_to_model`

* add few more tests

* parallel execution of model versions

* add version number

* improve readability

* protect from misuse

* extend `ArtifactConfig.model_version`

* align model config docstrings

* stabilize parallelized test

* rename `model.py`

* rename

* add cli for model watchtower

* rework test as subprocess calls

* Apply suggestions from code review

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* reshape tests

* rebranding

* skip subprocess test on windows

* sort init

* remove redundant param from `print_pydantic_models`

* reduce redundant code

* reduce too long line

* add model update

* after merge mess

* lint

* update tests flow based on develop

* proper handle __latest__ mv in REST

* fix get model version endpoint

* calm down linter

* restore proper name

* typing import error

* after merge mess

---------

Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* fallback to previous template

* fallback to previous template

---------

Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
avishniakov added a commit that referenced this pull request Oct 11, 2023
* Discord alerter integration (#1818)

* discord component integration

* corrected library name and added necessary import

* reformattes

* fixed some issues

* Format

* added test cases and fixed a annotation issue in discord_alerter.py

* modified logic to explicitly check for none embed object

* doc changes

* Apply suggestions from code review

* Minor improvements to integration test

* Docs: add more details on where to find the required parameters

* Handle closed asyncio loops

---------

Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Felix Altenberger <[email protected]>

* Update Neptune dependency: `neptune-client` > `neptune` (#1837)

* Update Neptune dependency: neptune-client > neptune

* 'Fix' typing

* Fix flaky label studio unit tests

* disable codeql on develop pushes (#1842)

* Template not updating due to git diff misuse (#1844)

* fix CI for templates

* debug run

* revert changes

* Auto-update of E2E template

* trigger ci

* revert ci

---------

Co-authored-by: GitHub Actions <[email protected]>

* Bump feast version to fix api docs generation (#1845)

* CI Fixes / Improvements (#1848)

* Move e2e template test into update action and remove starter template test

* Fix flaky ZenStore test

* Pin evidently since newest version breaks Docker runs

* Fix OOM issue by disabling SkyPilot test

* fixing template failures

* Revert "fixing template failures"

This reverts commit 280e117.

---------

Co-authored-by: Andrei Vishniakov <[email protected]>

* Fix MLflow registry methods with empty metadata (#1843)

* Fix MLflow registry methods with empty metadata

* Auto-update of E2E template

* add new template release

* Auto-update of E2E template

---------

Co-authored-by: Andrei Vishniakov <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>

* Use configured template REF in CI (#1851)

* use ref from config for template

* suppress log output in getting env

* hardcode template ref

* add helper text

* revert debug changes

* aligh template ref

* Fix template REF in CI (#1852)

* debug

* update branch naming

* rename release

* Auto-update of E2E template

* remove debug comments

---------

Co-authored-by: GitHub Actions <[email protected]>

* Fix AWS service connector installation requirements (#1850)

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* [Docs] Improvements to custom flavor and custom orchestrator pages (#1747)

* Added link to end-to-end custom orchestrator guide

* Finished doc for custom flavor

* Added reference on top of each doc page

* Update docs/book/stacks-and-components/component-guide/writing-custom-components.md

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update docs/book/stacks-and-components/component-guide/writing-custom-components.md

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update docs/book/stacks-and-components/component-guide/writing-custom-components.md

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Applied code changes

* Added title

* Added some minor modificatiosn for cloud docs

* Apply suggestions from code review

Co-authored-by: Barış Can Durak <[email protected]>

* Apply suggestions from code review

Co-authored-by: Barış Can Durak <[email protected]>

* Apply review suggestions and add line breaks

* Merge and redesign the two custom flavor docs pages

* Adjust links

* Adjust to review suggestion

* Apply suggestions from code review

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Move custom component docs to stacks-and-components/custom-solutions

* Apply suggestions from code review

Co-authored-by: Barış Can Durak <[email protected]>

---------

Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Barış Can Durak <[email protected]>
Co-authored-by: Felix Altenberger <[email protected]>

* Optimizing the performance through database changes (#1835)

* removed unused imports

* mixed typos

* removed the pipeline and step run relationship

* formatted and removed pipeline run relationship

* removed run relationship

* adding references

* add versions to the deployment model

* removed num_steps

* cleaning

* orchestrators adjusted

* added run and step run back

* changed the model conversion

* major updates to deployment, pipeline run and step run schemas and their model conversion

* added new version fields

* more changes to the models

* removing unneccessary queries and hydration

* typo

* removing user hydration from various schemas

* adding back the filtering

* formatting

* fixing filter models

* getting rid of warnings

* alembic migration

* formatting and linting

* fixing tests

* fixing tests

* fixed the num steps

* moving imports

* changing the request model

* fixing the migration issues

* optimizing fetching the producer id

* fixed the cascase delete in schema relationships

* formatting

* fixing the artifact schema

* fixed the num step problem

* removed old migration script

* new migration script

* Update src/zenml/config/compiler.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* formatting

* fixing request model in integration tests

* adding pipeline id back in

* missing cascade delete

* test switched to clean workspace

* excluded runs from crud tests as deployments do not exist yet

* using clean workspaces

* fixed attribute

* removed duplicated test

* proper cleaning for runs and artifacts after context

---------

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Add `README` for `examples` folder (#1860)

* draft README file

* update with templates info

* updated following PR comments

* reorder table

* Free up disk space in CI (#1863)

* remove deepchecks tests from CI

* remove pytorch

* remove pytorch_lightning

* try tensorflow instead of pytorch

* formatting

* remove TF tests

* formatting

* try free ubuntu action

* refactor

* add skypilot back in

* install missing pkg and update tests

* add missing conditional to yaml

* with permissions

* remove tool cache as well

* Make Terraform Optional Again (#1855)

* Make terraform an optional dependency

* Mypy: ignore IPython imports

* Delete unused zenml.recipes

* Delete all unused constants

---------

Co-authored-by: Michael Schuster <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* rename watchtower (#1868)

* Corrected 'zenml pipelines list' command (#1872)

* Fix CI by freeing up space on runner (#1866)

* try more free space removal

* fix interpolation

* fix again

* remove docker image deletion completely

* codeql runs less frequently

* remove TF installation

* add terraform & disable integration tests for ubuntu 3.11

* revert indentation

* Allow for `user` param to be specified (successfully) in `DockerSettings` (#1857)

* fix user bug

* update test

* Update src/zenml/utils/pipeline_docker_image_builder.py

* Update tests/unit/utils/test_pipeline_docker_image_builder.py

Co-authored-by: Felix Altenberger <[email protected]>

---------

Co-authored-by: Felix Altenberger <[email protected]>

* Add `get_pipeline_context` (#1870)

* add `get_pipeline_context`

* add docs

* format example better

* more meaningful example

* update example

* fix example

---------

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* require the json content of the file instead of the path (#1874)

* External authenticator support, authorized devices and web login (#1814)

* Auth changes for external authenticator support

* consolidated ZenML Server configuration in its own class
* moved JWT token authentication related logic to its own class
* add support for more JWT token claims (issuer, audience)
* add support for JWKS (public key criptography) secret keys
* add support in client (REST Store) to automatically re-authenticate
when a temporary JWT token expires
* add support to store JWT access tokens in HTTP-only cookies with
configurable domain and cookie name for increased security (TBD UI
needs to be updated to not store tokens)

Breaking changes:

* renamed env variable ZENML_AUTH_TYPE to ZENML_SERVER_AUTH_SCHEME
* renamed env variable ZENML_JWT_SECRET_KEY to ZENML_SERVER_JWT_SECRET_KEY

* Add external authenticator support

* Add DB migration

* Add logout endpoint and other minor fixes

* Minor improvements and DB migration script

* Add CORS configuration to ZenML server

* Minor fixes

* Fixed linter errors

* Fix darglint and security errors

* Code review feedback and other minor improvements

* Update src/zenml/zen_server/routers/auth_endpoints.py

Co-authored-by: Alexej Penner <[email protected]>

* Fix linter

* Add support for web login and authorized devices

* Add client and CLI support for authorized devices.

* Add external server ID and remove default user and stack if external authenticator is used

* Add all properties to authorized devices

* Add IP address location

* Fix ipinfo version

* Fix linter

* Fixed device authorization flow

* Updated docs to suggest web login instead of username/pass login

* Fix linter

* Add API token endpoint and use it to issue workload tokens

* Fix linter

* Fix docstring errors

* Fix alembic migration fork

* Use configured max_failed_device_auth_attempts instead of default value

* Switch to logger

* Fix typo

* Allow configuration of pipeline api token expiration

* Analytics changes

* Use external user email as unique username

* Add missing identify event

* Remove unused import

* Add missing constant

---------

Co-authored-by: Alexej Penner <[email protected]>
Co-authored-by: Michael Schuster <[email protected]>

* Add missing prefix to constant

* Connect to Service-connector at component registration (#1858)

* add connect attribute to stack component register command to connect service connector

* apply suggested reviews

* fixed upgrade script (#1877)

* [Model Control Plane] early release (#1816)

* Implementation of Model table (#1802)

* [Model Watch Tower] Adding ModelVersion and ModelVersionLink entities (#1811)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* fix tests in docker

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

---------

Co-authored-by: Felix Altenberger <[email protected]>

* [Model Watch Tower] Implement `zenml.log_artifact_metadata()` (#1813)

* Delete dead code

* Implement zenml.log_artifact_metadata()

* Improve error handling and add tests

* Remove 'description' arg of log_artifact_metadata() and fix docstring

* Fix test name

* Remove TODOs

* Rewrite create_run_metadata() to make batch API requests

* Adjust unit tests

* Fix flaky test_is_secret_reference

* Fix integration tests

* [Model Watch Tower] Add ModelConfig (#1817)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* lint

* remove `ModelStages._members()`

* improve wording

* Union[str, ModelStages]

* simplify `get_model_version` to one endpoint

* remove `_get_request_params`

* split `_get_or_create_model_version`

* ensure `get_or_create_model` is stable

* add docstrings

* lint

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

---------

Co-authored-by: Felix Altenberger <[email protected]>

* lint

* [Model WatchTower] add ModelConfig to step and pipeline decorators (#1819)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add docstring

* cleaning up after merge

* move `ModelBaseModel` back to `models`

* direct imports

* breaking another circular dep

* and one more circular dep

---------

Co-authored-by: Felix Altenberger <[email protected]>

* [Model WatchTower] Add ArtifactConfig (+OSS-2427) & model version management in context (partially)  (#1822)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add artifact config and necessary registrations around it

* fix bug with `Output` annotation

* add docstring

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* cleaning up after merge

* move `ModelBaseModel` back to `models`

* direct imports

* breaking another circular dep

* clean-up after conflicts resolution

* and one more circular dep

* and one more circular dep

* update tests to include `OutputSignature`

* add `link_output_to_model`

* stabilize tests

* add implicit linkage

* more tests

* lint

* docstrings

* test/bug fixes

* extend artifact link key to pipe/step/name

* lint

* fix for 3.8

* fix failing test call signatures

* update_forward_refs centrally

* Update src/zenml/model/artifact_config.py

Co-authored-by: Felix Altenberger <[email protected]>

* Update src/zenml/zen_stores/sql_zen_store.py

Co-authored-by: Felix Altenberger <[email protected]>

* add a warning about not supported feature

* add arguments descriptions

* improve docstrings a bit

* assign_version_to_running internal + docs

* rename to link_version

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Felix Altenberger <[email protected]>

* rename arg in test

* lint

* refactor a bit

* address PR comment

* remove deleted classes

* Update src/zenml/models/model_base_model.py

Co-authored-by: Felix Altenberger <[email protected]>

* move `ModelStages` to enums

* merge `model_stage` and add tests for it

* simplify `_link_artifacts_to_model` args

* docstrings

* docstrings

* lint

* fix args in tests

* fix __mro__ test failure

* fix for mlflow test

* stabilize test_list_runs_is_ordered

* fix pagination in some tests

* address PR comments

---------

Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* [Model WatchTower] Delete running versions on failed pipelines with `delete_new_version_on_failure ` option (#1825)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add artifact config and necessary registrations around it

* fix bug with `Output` annotation

* add docstring

* delete running versions on fail

* add deletion test

* don't return running without recovery

* remove base_model.py

* PR comments

* remove merged migration

* PR comments

* improve model_config warnings

* clean up merge mess

* bandit is too strict

* typos

* clean up merge mess

* remove not relevant asserts

* improve docs

* improve docs

* rely on deployment in `get_new_version_requests`

* stabilize tests in random order

* improve docs

* stabilize tests

---------

Co-authored-by: Felix Altenberger <[email protected]>

* Fix OOM issue by disabling SkyPilot test

* [Model WatchTower] Extend `ExternalArtifact` (#1839)

* big bang commit

* typo

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* add Alembic

* lint

* mypy

* darglint

* wip

* wip

* wip

* wip

* add endpoints

* add ModelStages

* wip

* work with client

* handle tags

* fix integrations

* move list around

* update db schema

* wip

* lint

* sync with model branch

* wip

* refactor

* add stage transition

* add update interface

* add model version links

* lint

* fix crud tests

* fix alembic branching

* patch azure

* lint

* use zenml StrEnum

* fix param name

* ModelConfig implementation

* start testing

* fix tests in docker

* more tests

* fix tests for mysql

* rename artifact ids variables

* reorder methods

* add direct getters

* lint

* split links into 2 tables

* lint

* pr comments

* add ModelConfig to step deco

* Revert "add ModelConfig to step deco"

This reverts commit ba9fd6a.

* add ModelConfig to step deco

* lint

* wip

* Add model_config to @pipeline and @step

* add artifact config and necessary registrations around it

* fix bug with `Output` annotation

* add docstring

* delete running versions on fail

* add deletion test

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* cleaning up after merge

* move `ModelBaseModel` back to `models`

* direct imports

* breaking another circular dep

* clean-up after conflicts resolution

* and one more circular dep

* and one more circular dep

* update tests to include `OutputSignature`

* add `link_output_to_model`

* stabilize tests

* add implicit linkage

* more tests

* lint

* docstrings

* test/bug fixes

* extend artifact link key to pipe/step/name

* lint

* fix for 3.8

* fix failing test call signatures

* update_forward_refs centrally

* Update src/zenml/model/artifact_config.py

Co-authored-by: Felix Altenberger <[email protected]>

* Update src/zenml/zen_stores/sql_zen_store.py

Co-authored-by: Felix Altenberger <[email protected]>

* add a warning about not supported feature

* add arguments descriptions

* improve docstrings a bit

* assign_version_to_running internal + docs

* rename to link_version

* Update src/zenml/new/pipelines/pipeline.py

Co-authored-by: Felix Altenberger <[email protected]>

* rename arg in test

* lint

* refactor a bit

* address PR comment

* remove deleted classes

* Update src/zenml/models/model_base_model.py

Co-authored-by: Felix Altenberger <[email protected]>

* move `ModelStages` to enums

* merge `model_stage` and add tests for it

* simplify `_link_artifacts_to_model` args

* docstrings

* docstrings

* lint

* fix args in tests

* fix __mro__ test failure

* fix for mlflow test

* stabilize test_list_runs_is_ordered

* update .gitignore

* fix pagination in some tests

* don't return running without recovery

* remove base_model.py

* PR comments

* remove merged migration

* PR comments

* improve model_config warnings

* clean up merge mess

* external artifacts for model watchtower

* bandit is too strict

* typos

* clean up merge mess

* remove not relevant asserts

* improve docs

* improve docs

* rely on deployment in `get_new_version_requests`

* stabilize tests in random order

* improve docs

* use utils model_killer

* clean up merge mess

* use Annotated from typing_extensions

* one more circular dep case

* lint

* resolve alembic branching

* Apply suggestions from code review

Co-authored-by: Felix Altenberger <[email protected]>

* get rid of `_testable_upload_if_necessary`

* refactor `upload_if_necessary`

* `zenml.artifacts.external_artifact.ExternalArtifact`

* add tests for getters of MV response

* improve docstring

* fix before  #1835

* lint

* remove  `_import_client`

* fixing issues highlighted by tests

* update docstrings

* fix year in license

* add docstrings

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/steps/external_artifact.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update src/zenml/models/model_models.py

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* fix docstrings

* Move UnmaterializedArtifact to zenml.artifacts

* add fix of path in docs

* split ExternalArtifact into user class and config for step

* update template working branch

* restrict pydantic

* Revert "restrict pydantic"

This reverts commit b94e01f.

---------

Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* [Model WatchTower] Extend client (#1849)

* extend client for Model WatchTower

* resolve alembic branching

* aligh template ref

* Auto-update of E2E template

* [Model WatchTower] link runs to model versions (#1847)

* linkage of pipeline runs

* add docstring

* tricky bug

* full linkage on consumption

* lint

* use client

* Auto-update of E2E template

* update outdated test

* create new version if any step touching it is executed and it was requested elsewhere

* refactor `_link_pipeline_run_to_model`

* add few more tests

---------

Co-authored-by: GitHub Actions <[email protected]>

* remove deepchecks tests from CI

* remove pytorch

* remove pytorch_lightning

* try tensorflow instead of pytorch

* formatting

* remove TF tests

* formatting

* try free ubuntu action

* refactor

* add skypilot back in

* install missing pkg and update tests

* add missing conditional to yaml

* with permissions

* add template release

* [Model Control Plane] parallel running versions support (#1859)

* linkage of pipeline runs

* add docstring

* tricky bug

* full linkage on consumption

* lint

* use client

* Auto-update of E2E template

* update outdated test

* create new version if any step touching it is executed and it was requested elsewhere

* refactor `_link_pipeline_run_to_model`

* add few more tests

* parallel execution of model versions

* add version number

* improve readability

* protect from misuse

* extend `ArtifactConfig.model_version`

* align model config docstrings

* stabilize parallelized test

* rework test as subprocess calls

* skip subprocess test on windows

* after merge mess

* update tests flow based on develop

* proper handle __latest__ mv in REST

* fix get model version endpoint

* simplify user-facing interface

* fix test annotation

---------

Co-authored-by: GitHub Actions <[email protected]>

* [Model Control Plane] Add CLI (#1861)

* linkage of pipeline runs

* add docstring

* tricky bug

* full linkage on consumption

* lint

* use client

* Auto-update of E2E template

* update outdated test

* create new version if any step touching it is executed and it was requested elsewhere

* refactor `_link_pipeline_run_to_model`

* add few more tests

* parallel execution of model versions

* add version number

* improve readability

* protect from misuse

* extend `ArtifactConfig.model_version`

* align model config docstrings

* stabilize parallelized test

* rename `model.py`

* rename

* add cli for model watchtower

* rework test as subprocess calls

* Apply suggestions from code review

Co-authored-by: Alex Strick van Linschoten <[email protected]>

* reshape tests

* rebranding

* skip subprocess test on windows

* sort init

* remove redundant param from `print_pydantic_models`

* reduce redundant code

* reduce too long line

* add model update

* after merge mess

* lint

* update tests flow based on develop

* proper handle __latest__ mv in REST

* fix get model version endpoint

* calm down linter

* restore proper name

* typing import error

* after merge mess

---------

Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* fallback to previous template

* fallback to previous template

---------

Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>

* Update to templates (#1878)

* Extended template capabilities

* Github action changed and new templat features added

* Docs updated to include more about templates

* Github workflow updated

* Renaming files is bigger than i thought

* Update src/zenml/cli/base.py

Co-authored-by: Andrei Vishniakov <[email protected]>

* Help

* Final changes

* More tags

* More tags

---------

Co-authored-by: Andrei Vishniakov <[email protected]>

* Docs for orgs, rbac and sso (#1875)

* Orgs, Rbac and SSO

* Apply suggestions from code review

* Update docs/book/deploying-zenml/zenml-cloud/user-management.md

---------

Co-authored-by: Hamza Tahir <[email protected]>

* Convert network_config dict to NetworkConfig object in SageMaker orchestrator (#1873)

* Convert network_config dict to NetworkConfig object in orchestrator

* Slightly better input checking

* Remove f-strings (no placeholders)

* Fix sort order of NetworkConfig import block

* Remove redundant reraise

* Reformatting with black

* Add TypeError Raises

* Remove line

---------

Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Hamza Tahir <[email protected]>

* add missing docker build options for gcp image builder (#1856)

* solve alembic branching

---------

Co-authored-by: Priyadutt <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Felix Altenberger <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Stefan Nica <[email protected]>
Co-authored-by: Hamza Tahir <[email protected]>
Co-authored-by: Barış Can Durak <[email protected]>
Co-authored-by: Michael Schuster <[email protected]>
Co-authored-by: Vishal Kumar. S <[email protected]>
Co-authored-by: Jayesh Sharma <[email protected]>
Co-authored-by: Alexej Penner <[email protected]>
Co-authored-by: Safoine El Khabich <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Christian Versloot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal To filter out internal PRs and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants