<@U06RKAMK0UC> can I trigger a workflow from a pyt...
# ask-ai
s
@ancient-wolf-19325 can I trigger a workflow from a python script?
a
Yes, you can trigger a Flyte workflow from a Python script using the FlyteRemote API. You first create a FlyteRemote object, fetch the workflow (or launch plan), and then execute it with the desired inputs. This works for both locally imported workflows and those registered on a Flyte cluster. For example:
Copy code
from flytekit.configuration import Config
from flytekit.remote import FlyteRemote

remote = FlyteRemote(config=Config.auto(), default_project="my_project", default_domain="development")
flyte_wf = remote.fetch_workflow(name="workflows.example.wf")
execution = remote.execute(flyte_wf, inputs={"name": "Kermit"}, wait=True)
print(execution.outputs)
According to the documentation, you can also execute a locally imported workflow directly if it is available in your Python environment. See more details in the Flyte documentation. Would you like more detail or examples for specific use cases? Sources: - Running and scheduling workflows - Running workflows - FlyteRemote API 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@ancient-wolf-19325 how does auth work with FlyteRemote
a
Authentication with FlyteRemote is handled via the configuration provided to the FlyteRemote object, typically using a config file or environment variables. The config specifies the endpoint, client ID, auth mode (e.g., Pkce, DeviceFlow, client_credentials, basic), and secrets (client secret or token), which FlyteRemote uses to authenticate with the Flyte backend. Supported auth flows include browser-based PKCE, device flow for headless environments, and client credentials for automation, as described in the Flyte configuration and auth docs. If using PKCE or DeviceFlow, tokens are cached and refreshed as needed. For client_credentials or basic, secrets are read from environment variables, files, or directly from the config. The authentication mode and credentials must match the Flyte deployment's configuration. Would you like more detail on configuring a specific auth mode or troubleshooting authentication? Sources: - Flyte configuration internal.py - Document supported authType values 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.