zenml
zenml copied to clipboard
Pending Changes for Active Stack
Describe changes
I implemented changes that were left-over as a part of #2370.
Pre-requisites
Please ensure you have done the following:
- [x] I have read the CONTRIBUTING.md document.
- [x] I have added tests to cover my changes.
- [x] I have based my new branch on
developand the open PR is targetingdevelop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop. - [x] IMPORTANT: I made sure that my changes are reflected properly in the following resources:
- [x] ZenML Docs
- [x] Dashboard: Needs to be communicated to the frontend team.
- [x] Templates: Might need adjustments (that are not reflected in the template tests) in case of non-breaking changes and deprecations.
- [x] Projects: Depending on the version dependencies, different projects might get affected.
Types of changes
- [x] 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)
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
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.
🪧 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>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
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)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@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! Let me know if this sounds good. If you have any pointers on how to test this change specifically, I would really appreciate this.
PipelineDefinition.create_run_template
When create_run_template function is called, it is already within the context manager of temporary_active_stack:
https://github.com/zenml-io/zenml/blob/0d059d3a54d7ab86b2e3057319fb75f2e6c25451/src/zenml/cli/pipeline.py#L363
I can also add a context manager but I believe this case is already handled.
PipelineDefinition.create_run_template
When
create_run_templatefunction is called, it is already within the context manager oftemporary_active_stack:https://github.com/zenml-io/zenml/blob/0d059d3a54d7ab86b2e3057319fb75f2e6c25451/src/zenml/cli/pipeline.py#L363
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 --stack CLI option via the newly introduced PipelineRunConfiguration.stack attribute if set.
@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: bash scripts/test-coverage-xml.sh
PipelineDefinition.create_run_template
When
create_run_templatefunction is called, it is already within the context manager oftemporary_active_stack: https://github.com/zenml-io/zenml/blob/0d059d3a54d7ab86b2e3057319fb75f2e6c25451/src/zenml/cli/pipeline.py#L363I 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
--stackCLI option via the newly introducedPipelineRunConfiguration.stackattribute if set.
One last question. I did pass the stack option to the pipeline_instance.with_options. However, passing it to the create_run_template, there are a couple of calls this function is making:
deployment = self._create_deployment(**self._run_args, skip_schedule_registration=True)
return Client().create_run_template(name=name, deployment_id=deployment.id, **kwargs)
Here the create_run_template, but it is not possible (or required) to patch the stack. Let me know if this needs to be updated.
However, _create_deployment seems an important place that uses stack option. This calls the _compile function which initializes the PipelineRunConfiguration. But there is no easier way to pass it outside of the configuration file. The options passed from parent functions are hidden, and the options from config file are not overridden.
https://github.com/zenml-io/zenml/blob/271076b49fa4fb6954cebf0a8b8e497bc4d2ae9a/src/zenml/pipelines/pipeline_definition.py#L1053.
Any suggestions?
@schustmi Friendly ping for the clarification :)
@schustmi It's been a while! Any feedback on the comment above?
@preyasshah9 Sorry for the late comment, I lost track of this among so many ongoing things.
The code in the pipeline_definition.py file on develop has changed a bit, can you resolve those merge conflicts before we have another look please.
In general, the create_run_template method when being called from a python file by the user (not using the CLI function) will still not respect the stack. So yes you're right we might need to implement this generically in the _create_deployment method somehow.
The merge conflicts have been resolved!
Hey @preyasshah9, thank you for your contribution on this ticket. I'm closing it due to staleness, feel free to reopen it if you'd like to keep working on it.