-
Notifications
You must be signed in to change notification settings - Fork 548
Additional caching configurations #4040
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
Open
schustmi
wants to merge
18
commits into
develop
Choose a base branch
from
feature/additional-caching-options
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+509
−20
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1db994a
Add option to specify python objects, files and cache function for ca…
schustmi b3b0236
Cache expiration
schustmi be5943c
Linting + docstrings
schustmi e3a5278
Docs
schustmi 2abee6b
Unit tests
schustmi 3dfe6b1
Cache expiration integration test
schustmi 7e207d7
Fix existing test
schustmi a64004e
Merge branch 'develop' into feature/additional-caching-options
schustmi b1759ae
Source docs
schustmi 55af738
Allow updating cache expiration
schustmi 73e2978
Typo
schustmi 6253820
Merge branch 'develop' into feature/additional-caching-options
schustmi 1d36d50
Include source docs in TOC
schustmi 8d564ca
Make docs nicer and reference in other pages
schustmi a13f2f4
Add docs on how to manually expire cache
schustmi 3b1139c
Fix relative link
schustmi 7c8d778
Fix typo
schustmi 94ce089
Make step run start time non-optional
schustmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
description: Understanding source roots and source paths | ||
icon: folders | ||
--- | ||
|
||
# Source Code and Imports | ||
|
||
When ZenML interacts with your pipeline code, it needs to understand how to locate and import your code. This page explains how ZenML determines the source root directory and how to construct source paths for referencing your Python objects. | ||
|
||
## Source Root | ||
|
||
The **source root** is the root directory of all your local code files. | ||
|
||
ZenML determines the source root using the following priority: | ||
|
||
1. **ZenML Repository**: If you're in a child directory of a [ZenML repository](https://docs.zenml.io/user-guides/best-practices/set-up-your-repository) (initialized with `zenml init`), the repository directory becomes the source root. We recommend always initializing a ZenML repository to make the source root explicit. | ||
|
||
2. **Execution Context Fallback**: If no ZenML repository exists in your current working directory or parent directories, ZenML uses the parent directory of the Python file you're executing. For example, running `/a/b/run.py` sets the source root to `/a/b`. | ||
|
||
{% hint style="warning" %} | ||
If you're running in a notebook or an interactive Python environment, there will be no file that is currently executed and ZenML won't be able to automatically infer the source root. Therefore, you'll need to explicitly define the source root by initializing a ZenML repository in these cases. | ||
{% endhint %} | ||
|
||
## Source Paths | ||
|
||
ZenML requires source paths in various configuration contexts. These are Python-style dotted paths that reference objects in your code. | ||
|
||
### Common Use Cases | ||
|
||
**Step Hook Configuration**: | ||
```yaml | ||
success_hook_source: <SUCCESS-HOOK-SOURCE> | ||
``` | ||
|
||
**Pipeline Deployment via CLI**: | ||
```bash | ||
zenml pipeline deploy <PIPELINE-SOURCE> | ||
``` | ||
|
||
### Path Construction | ||
|
||
Import paths must be **relative to your source root** and follow Python import syntax. | ||
|
||
**Example**: Consider this pipeline in `/a/b/c/run.py`: | ||
```python | ||
from zenml import pipeline | ||
|
||
@pipeline | ||
def my_pipeline(): | ||
... | ||
``` | ||
|
||
The source path depends on your source root: | ||
- Source root `/a/b/c` → `run.my_pipeline` | ||
- Source root `/a` → `b.c.run.my_pipeline` | ||
|
||
{% hint style="info" %} | ||
Note that the source is not a file path, but instead its elements are separated by dots similar to how you would write import statements in Python. | ||
{% endhint %} | ||
|
||
## Containerized Step Execution | ||
|
||
When running pipeline steps in containers, ZenML ensures your source root files are available in the container (either by including them in the image or downloading them at runtime). | ||
|
||
To execute your step code, ZenML imports the Python module containing the step definition. **All imports of local code files must be relative to the source root** for this to work correctly. | ||
|
||
{% hint style="info" %} | ||
If you don't need all files inside your source root for step execution, see the [containerization guide](../containerization/containerization.md#controlling-included-files) for controlling which files are included. | ||
{% endhint %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.