Skip to content

Commit

Permalink
Update lp.py (flyteorg#181)
Browse files Browse the repository at this point in the history
* Update lp.py

"How to add launch plans" page has been integrated into Launch Plans.

* Update lp.py (flyteorg#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 (flyteorg#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 <aallasamhita@gmail.com>

* Update cookbook/core/flyte_basics/lp.py

Co-authored-by: Samhita Alla <aallasamhita@gmail.com>

* Update lp.py

Co-authored-by: Niels Bantilan <niels.bantilan@gmail.com>
Co-authored-by: Samhita Alla <aallasamhita@gmail.com>
  • Loading branch information
3 people committed May 5, 2021
1 parent aea197f commit 35fe9db
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions cookbook/core/flyte_basics/lp.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
"""
.. _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.
"""

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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 35fe9db

Please sign in to comment.