user
02/14/2024, 11:06 PMfaint-rocket-14513
02/14/2024, 11:07 PMFlyteRemote
class from the flytekit
package. Here's a step-by-step guide based on the provided context: 1. Import Necessary Modules: First, import FlyteRemote
and Config
from flytekit
. from flytekit.remote import FlyteRemote from flytekit.configuration import Config
2. Create a FlyteRemote Object: Instantiate a FlyteRemote
object with the appropriate configuration. You need to specify the endpoint, the default project, and the default domain. remote = FlyteRemote( config=Config.for_endpoint(endpoint="<http://flyte.example.net|flyte.example.net>"), default_project="flytesnacks", default_domain="development", )
3. Fetch the Workflow: Use the fetch_workflow
method of the FlyteRemote
object to fetch the workflow you want to execute. You need to provide the name and version of the workflow. flyte_workflow = remote.fetch_workflow(name="<http://workflows.example.wf|workflows.example.wf>", version="v1")
4. Execute the Workflow: Finally, execute the workflow using the execute
method. You need to pass the workflow object, a dictionary of inputs, and optionally, an execution name or prefix. You can also specify whether to wait for the execution to complete with the wait
parameter. # Execute with a specific execution name execution = remote.execute( flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True ) # Or use execution_name_prefix to avoid repeated execution names execution = remote.execute( flyte_workflow, inputs={"mean": 1}, execution_name_prefix="flyte", wait=True )
This process allows you to manually trigger a workflow execution using Flyte's Python API. Make sure to replace "<http://flyte.example.net|flyte.example.net>"
, "<http://workflows.example.wf|workflows.example.wf>"
, "v1"
, and the inputs dictionary with the actual values relevant to your workflow.brash-honey-82710
02/14/2024, 11:09 PMfaint-rocket-14513
02/14/2024, 11:09 PMbrash-honey-82710
02/14/2024, 11:11 PMfaint-rocket-14513
02/14/2024, 11:12 PMbrash-honey-82710
02/14/2024, 11:12 PMfaint-rocket-14513
02/14/2024, 11:12 PMbrash-honey-82710
02/14/2024, 11:15 PMfaint-rocket-14513
02/14/2024, 11:15 PM