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 missing docs #3226

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ This is a [ZenML Pro](https://zenml.io/pro)-only feature. Please

![Working with Templates](../../../.gitbook/assets/run-templates.gif)

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Use templates: Python SDK</td><td></td><td></td><td><a href="use-templates-python.md">use-templates-python.md</a></td></tr><tr><td>Use templates: Dashboard</td><td></td><td></td><td><a href="use-templates-dashboard.md">use-templates-dashboard.md</a></td></tr><tr><td>Use templates: Rest API</td><td></td><td></td><td><a href="use-templates-rest-api.md">use-templates-rest-api.md</a></td></tr></tbody></table>
<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Use templates: Python SDK</td><td></td><td></td><td><a href="use-templates-python.md">use-templates-python.md</a></td></tr><tr><td>Use templates: CLI</td><td></td><td></td><td><a href="use-templates-cli.md">use-templates-cli.md</a></td></tr><tr><td>Use templates: Dashboard</td><td></td><td></td><td><a href="use-templates-dashboard.md">use-templates-dashboard.md</a></td></tr><tr><td>Use templates: Rest API</td><td></td><td></td><td><a href="use-templates-rest-api.md">use-templates-rest-api.md</a></td></tr></tbody></table>
<figure><img src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" alt="ZenML Scarf"><figcaption></figcaption></figure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
description: Create a template using the ZenML CLI
---

{% hint style="success" %}
This is a [ZenML Pro](https://zenml.io/pro)-only feature. Please
[sign up here](https://cloud.zenml.io) to get access.
{% endhint %}

## Create a template

You can use the ZenML CLI to create a run template:

```bash
# The <PIPELINE_SOURCE_PATH> will be `run.my_pipeline` if you defined a
# pipeline with name `my_pipeline` in a file called `run.py`
zenml pipeline create-run-template <PIPELINE_SOURCE_PATH> --name=<TEMPLATE_NAME>
```

{% hint style="warning" %}
You need to have an active **remote stack** while running this command or you can specify
one with the `--stack` option.
{% endhint %}


<!-- For scarf -->
<figure><img alt="ZenML Scarf" referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" /></figure>

Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Find out which configuration was used for a run

Sometimes you might want to extract the used configuration from a pipeline that has already run. You can do this simply by loading the pipeline run and accessing its `config` attribute.
Sometimes you might want to extract the used configuration from a pipeline that has already run. You can do this simply by loading the pipeline run and accessing its `config` attribute or the `config` attribute of one of its steps.

<pre class="language-python"><code class="lang-python">from zenml.client import Client
```python
from zenml.client import Client

pipeline_run = Client().get_pipeline_run("&#x3C;PIPELINE_RUN_NAME>")
pipeline_run = Client().get_pipeline_run(<PIPELINE_RUN_NAME>)

<strong>configuration = pipeline_run.config
</strong></code></pre>
# General configuration for the pipeline
pipeline_run.config

# Configuration for a specific step
pipeline_run.steps[<STEP_NAME>].config
```

<figure><img src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" alt="ZenML Scarf"><figcaption></figcaption></figure>
1 change: 1 addition & 0 deletions docs/book/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
* [Get past pipeline/step runs](how-to/pipeline-development/build-pipelines/get-past-pipeline-step-runs.md)
* [Trigger a pipeline](how-to/pipeline-development/trigger-pipelines/README.md)
* [Use templates: Python SDK](how-to/pipeline-development/trigger-pipelines/use-templates-python.md)
* [Use templates: CLI](how-to/pipeline-development/trigger-pipelines/use-templates-cli.md)
* [Use templates: Dashboard](how-to/pipeline-development/trigger-pipelines/use-templates-dashboard.md)
* [Use templates: Rest API](how-to/pipeline-development/trigger-pipelines/use-templates-rest-api.md)
* [Use configuration files](how-to/pipeline-development/use-configuration-files/README.md)
Expand Down
15 changes: 15 additions & 0 deletions src/zenml/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2410,6 +2410,21 @@ def my_pipeline(...):
zenml pipeline run <PIPELINE_SOURCE_PATH> --stack=<STACK_ID_OR_NAME>
```

If you want to create a run template based on your pipeline that can later be used to trigger a run either from the dashboard or through an HTTP request:

```bash
zenml pipeline create-run-template <PIPELINE_SOURCE_PATH> \
--name=<TEMPLATE_NAME>

To specify a config file, use the `--config/-c` option. If you would like to use a different stack than the active one, use the `--stack` option.

```bash
zenml pipeline create-run-template <PIPELINE_SOURCE_PATH> \
--name=<TEMPLATE_NAME> \
--config=<PATH_TO_CONFIG_YAML> \
--stack=<STACK_ID_OR_NAME>
```

Tagging your resources with ZenML
---------------------------------

Expand Down
Loading