Skip to content

Commit

Permalink
reference lp example for flyteremote (#2747)
Browse files Browse the repository at this point in the history
* reference lp example for flyteremote

Signed-off-by: Daniel Sola <daniel.sola@union.ai>

* make title longer

Signed-off-by: Daniel Sola <daniel.sola@union.ai>

* newlines

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>

---------

Signed-off-by: Daniel Sola <daniel.sola@union.ai>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Co-authored-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
  • Loading branch information
dansola and wild-endeavor authored Sep 12, 2024
1 parent 8c6f6f0 commit 7f54171
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/source/design/control_plane.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,44 @@ To fetch output of a specific node execution:
:ref:`Node <flyte:divedeep-nodes>` here, can correspond to a task, workflow, or branch node.

Reference launch plan executions
================================

When retrieving and inspecting an execution which calls a launch plan, the launch plan manifests as a sub-workflow which
can be found within the ``workflow_executions`` of a given node execution. Note that the workflow execution of interest
must again be synced in order to inspect the input and output of the contained tasks.

.. code-block:: python
@task
def add_random(x: int) -> int:
return x + random.randint(1, 100)
@workflow
def sub_wf(x: int) -> int:
x = add_random(x=x)
return add_random(x=x)
sub_wf_lp = LaunchPlan.get_or_create(
name="sub_wf_lp",
workflow=sub_wf,
)
@workflow
def parent_wf(x: int = 1) -> int:
x = add_random(x=x)
return sub_wf_lp(x=x)
To get the output of the first ``add_random`` call in ``sub_wf``, you can do the following with the ``execution`` from the
``parent_wf``:

.. code-block:: python
execution = remote.fetch_execution(name="adgswtrzfn99k2cws49q", project="flytesnacks", domain="development")
remote.sync_execution(execution, sync_nodes=True)
remote.sync_execution(execution.node_executions['n1'].workflow_executions[0], sync_nodes=True)
out = execution.node_executions['n1'].workflow_executions[0].node_executions['n0'].outputs['o0']
****************
Listing Entities
****************
Expand Down

0 comments on commit 7f54171

Please sign in to comment.