From 35fe9db45f08fce3d94923b4245b1a9980a915ef Mon Sep 17 00:00:00 2001 From: SandraGH5 <80421934+SandraGH5@users.noreply.github.com> Date: Wed, 5 May 2021 10:15:13 -0700 Subject: [PATCH] Update lp.py (#181) * Update lp.py "How to add launch plans" page has been integrated into Launch Plans. * Update lp.py (#183) "How to add launch plans" page has been integrated into Launch Plans. Co-authored-by: SandraGH5 <80421934+SandraGH5@users.noreply.github.com> * Update lp.py * Sandra gh5 launch plans how to (#184) * Update lp.py "How to add launch plans" page has been integrated into Launch Plans. * Update lp.py Co-authored-by: SandraGH5 <80421934+SandraGH5@users.noreply.github.com> * Update cookbook/core/flyte_basics/lp.py Co-authored-by: Samhita Alla * Update cookbook/core/flyte_basics/lp.py Co-authored-by: Samhita Alla * Update lp.py Co-authored-by: Niels Bantilan Co-authored-by: Samhita Alla --- cookbook/core/flyte_basics/lp.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/cookbook/core/flyte_basics/lp.py b/cookbook/core/flyte_basics/lp.py index 756cada1c4..f442e1ce29 100644 --- a/cookbook/core/flyte_basics/lp.py +++ b/cookbook/core/flyte_basics/lp.py @@ -1,10 +1,8 @@ """ -.. _launch_plans: - Launch Plans ----------------------- +------------- -Launch plans bind a partial or complete list of inputs necessary to launch a workflow along +Launch plans bind a partial or complete list of inputs necessary to launch a workflow, along with optional run-time overrides such as notifications, schedules and more. Launch plan inputs must only assign inputs already defined in the reference workflow definition. """ @@ -12,10 +10,20 @@ import calendar # %% +# When To Use Launch Plans +# ######################## +# +# - For multiple schedules of a workflow with zero or more predefined inputs +# - To run a specific workflow but with a different set of notifications +# - To share a workflow with set inputs with another user, allowing the other user to simply kick off an execution +# - To share a workflow with another user, making sure that some inputs can be overridden if needed +# - To share a workflow with another user, ensuring that some inputs are not changed +# # Launch plans are the only means for invoking workflow executions. -# By default, a 'default' launch plan will be created during the serialization (and registration process), +# A 'default' launch plan will be created during the serialization (and registration process), # which will optionally bind any default workflow inputs and any default runtime options specified in the project # flytekit config (such as user role, etc). +# # The following example creates a default launch plan with no inputs during serialization. import datetime @@ -43,19 +51,19 @@ def my_wf(val: int) -> int: square_5 = my_lp(val=5) # %% -# In some cases you may want to **fix** launch plan inputs, such that they can't be overridden at execution call time. -my_fixed_lp = LaunchPlan.create("always_2_lp", my_wf, fixed_inputs={"val": 4}) +# It is possible to **fix** launch plan inputs, so that they can't be overridden at execution call time. +my_fixed_lp = LaunchPlan.get_or_create(name="always_2_lp", workflow=my_wf, fixed_inputs={"val": 4}) square_2 = my_fixed_lp() # error: # square_1 = my_fixed_lp(val=1) # %% -# Putting it all together +# Putting It All Together # ####################### # -# Default and fixed inputs can all be used in combination together to simplify individual executions -# or even programmatic ones. -# Let's take a look at a trivial example where we enthusiastically greet each day of the upcoming week: +# Default and fixed inputs can be used together to simplify individual executions +# and programmatic ones. +# Here is a simple example to greet each day of the upcoming week: @task