-
Notifications
You must be signed in to change notification settings - Fork 492
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
Pending Changes for Active Stack #3372
base: develop
Are you sure you want to change the base?
Pending Changes for Active Stack #3372
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
eb058fb
to
cede201
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one major part missing here still: When running/building a pipeline for which this config attribute is set, we actually need to use the temporary_active_stack
context manager to switch the stack for the run/build.
This will be in PipelineDefinion.build(...)
and PipelineDefinition._run(...)
.
@@ -46,6 +47,7 @@ class PipelineRunConfiguration( | |||
steps: Dict[str, StepConfigurationUpdate] = {} | |||
settings: Dict[str, SerializeAsAny[BaseSettings]] = {} | |||
tags: Optional[List[str]] = None | |||
stack: Optional[Stack] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an Optional[str]
instead. The Stack
object is not something that can be defined in a yaml file, which is usually how users specify attributes of this run configuration class. The value for stack
will be the name or ID of a stack, which will then be passed to temporary_active_stack
.
pipeline_id=pipeline_id, | ||
code_repository=code_repository, | ||
) | ||
with temporary_active_stack(stack_name_or_id=run_config.stack): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read the value of stack from the PipelineRunConfiguration
and if available use that within the temporary_active_stack
context manager. Same below.
@schustmi Hi Michael, Thank you for the feedback on PR. I have processed through code and tried to address your comment to best of my understanding. Let me know if this sounds good! |
25a491e
to
0d059d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I forgot: Could you also add this logic to temporarily set a different stack on the PipelineDefinition.create_run_template
method?
As for testing this:
- The test should first register a second stack (should probably just be default local orchestrator/artifact store)
- The active stack should be the default one
- We then configure any pipeline (just a single-step, do nothing pipeline should be fine) to run on a different stack.
- The above bullet point can be done either via a config file, or by passing it directly to
test_pipeline.with_options(stack=...)
. These should probably be two different test cases. - It should then run the pipeline
run = test_pipeline()
, and check whether the run ran on the configured stack.assert run.stack.id == ...
- We can then also check that the stack gets correctly reset to the previously active stack:
assert Client().active_stack.id == ...
I think examples for most of these can be found in tests/unit/pipelines/test_base_pipeline.py
(e.g. running a pipeline, configuring from a file). Let me know if I can help in any other way
local_repo = code_repository_utils.find_active_code_repository() | ||
code_repository = build_utils.verify_local_repository_context( | ||
deployment=deployment, local_repo_context=local_repo | ||
_from_config_file = self._parse_config_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of you having to do this manually before the compilation step in many places, but I also don't see any easy way around this. I'll refactor this (the entire config file logic is very messy right now) after this PR is merged.
When zenml/src/zenml/cli/pipeline.py Line 363 in 0d059d3
I can also add a context manager but I believe this case is already handled. |
Yep, but that is only available when using the CLI to create a run template, but not when doing this from purely in code. I think the better solution would be to remove the context manager from the CLI function, and instead pass the |
@schustmi Added some unit tests as per your comment. When I ran locally, I did not see issues related to the tests I added. I don't think unit tests are auto-executed by CI here. I executed tests on my branch using: |
One last question. I did pass the
Here the create_run_template, but it is not possible (or required) to patch the However, zenml/src/zenml/pipelines/pipeline_definition.py Line 1053 in 271076b
Any suggestions? |
@schustmi Friendly ping for the clarification :) |
Describe changes
I implemented changes that were left-over as a part of #2370.
Pre-requisites
Please ensure you have done the following:
develop
and the open PR is targetingdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes