brief-family-9488
11/01/2024, 8:28 PMjolly-florist-66728
11/01/2024, 8:28 PMLaunchPlan
and CronSchedule
classes from Flyte. Here's a basic example:
from flytekit import LaunchPlan, CronSchedule
from workflows.example import my_workflow
daily_launch_plan = LaunchPlan.get_or_create(
name="daily_launch_plan",
workflow=my_workflow,
schedule=CronSchedule(schedule="0 0 * * *"), # This cron expression runs the workflow daily at midnight
default_inputs={"input_name": "default_value"}, # Replace with actual default inputs
)
This code sets up a Launch Plan that schedules the workflow to run daily at midnight. Would you like more detail?
Sources:
- Running and Scheduling Workflows
- Schedules 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.brief-family-9488
11/01/2024, 8:44 PMjolly-florist-66728
11/01/2024, 8:44 PMpyflyte register
command. Ensure that your launch plan is defined in a Python module, and then execute the following command:
pyflyte register --project <project_name> --domain <domain_name> --version <version> <path_to_python_module>
This command registers all workflows, tasks, and launch plans defined in the specified Python module. Would you like more detail?
Sources:
- Scheduling a Launch Plan 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.brief-family-9488
11/01/2024, 8:45 PMjolly-florist-66728
11/01/2024, 8:45 PMFlyteRemote
interface, you can follow these steps:
1. Initialize FlyteRemote: Set up the FlyteRemote
object with the appropriate configuration.
2. Fetch or Create Launch Plan: Use LaunchPlan.get_or_create()
to define your launch plan.
3. Register Launch Plan: Use the register_launch_plan
method of FlyteRemote
.
Here's an example:
from flytekit import LaunchPlan, CronSchedule
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="<http://flyte.example.net|flyte.example.net>"),
default_project="flytesnacks",
default_domain="development",
)
# Define the launch plan
launch_plan = LaunchPlan.get_or_create(
name="daily_launch_plan",
workflow=my_workflow,
schedule=CronSchedule(schedule="0 0 * * *"), # Daily at midnight
)
# Register the launch plan
remote.register_launch_plan(
entity=launch_plan,
project="flytesnacks",
domain="development",
version="v1"
)
Would you like more detail?
Sources:
- Running Launch Plans 👍 1 button 👎 0 button 💡 Hint: Mention @ancient-wolf-19325 in the thread for followups.