From f656f54b57d1dd46c21fdde40ede01fcea23ae45 Mon Sep 17 00:00:00 2001 From: Jim Crist-Harif Date: Wed, 31 Mar 2021 10:49:56 -0500 Subject: [PATCH] Respond to feedback --- docs/core/examples/overview.md | 18 +++++++++++++----- docs/generate_docs.py | 2 +- examples/conditional.py | 6 +++--- examples/parameters.py | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/core/examples/overview.md b/docs/core/examples/overview.md index 4d7df0f11172..348bd8db238c 100644 --- a/docs/core/examples/overview.md +++ b/docs/core/examples/overview.md @@ -6,18 +6,26 @@ viewed live in the docs, or accessed from the GitHub repo ## Running with Prefect Cloud or Server -When running with Prefect Cloud or Prefect Server, you can register all the -examples in a new project by running the following: +When running with Prefect Cloud or Prefect Server, you can register the +examples in a new project with the Prefect CLI. You can either register all the +examples at once, or select specific examples by name. ``` -# Create a new project (optional) +# Create a new project named "Prefect Examples" $ prefect create project "Prefect Examples" # Register all the examples into the "Prefect Examples" project -$ prefect register --json https://docs.prefect.io/examples.json --project "Prefect Examples" +$ prefect register --json https://docs.prefect.io/examples.json \ + --project "Prefect Examples" + +# OR register only specific examples by specifying them by name +$ prefect register --json https://docs.prefect.io/examples.json \ + --project "Prefect Examples" \ + --name "Example: Parameters" \ + --name "Example: Mapping" ``` -These can then be run using any agent with an ``prefect-examples`` label. For +These can then be run using any agent with a ``prefect-examples`` label. For example, to start a local agent for running the examples: ``` diff --git a/docs/generate_docs.py b/docs/generate_docs.py index d6a2d5c180f6..1727c4b10cd8 100644 --- a/docs/generate_docs.py +++ b/docs/generate_docs.py @@ -442,7 +442,7 @@ def build_example(path): register_lines = [f"prefect register --json https://docs.prefect.io/examples.json"] for name in sorted(flows): - register_lines.append(f" --name {name}") + register_lines.append(f" --name {name!r}") register_lines.append(f" --project 'Prefect Examples'") rendered = EXAMPLE_TEMPLATE.format( diff --git a/examples/conditional.py b/examples/conditional.py index c46b81b873ef..250a94634782 100644 --- a/examples/conditional.py +++ b/examples/conditional.py @@ -65,12 +65,12 @@ def another_action(val): cond = check_condition() with case(cond, True): - val1 = action_if_true() + val_if_true = action_if_true() with case(cond, False): - val2 = action_if_false() + val_if_false = action_if_false() - val = merge(val1, val2) + val = merge(val_if_true, val_if_false) another_action(val) diff --git a/examples/parameters.py b/examples/parameters.py index 9ca7fedccc00..c18277c86307 100644 --- a/examples/parameters.py +++ b/examples/parameters.py @@ -27,7 +27,7 @@ def print_total(x, y, total): print(f"{x} + {y} = {total}") -with Flow("Examples: Parameters") as flow: +with Flow("Example: Parameters") as flow: x = Parameter("x", default=1) y = Parameter("y", default=2)