New RunLLM response generated: >>>*# Question* An...
# runllm-flyte-trial
j
New RunLLM response generated: >>>*# Question* Anyone know how to create a launch plan programmatically in Flyte? I've been trying to run this code:
Copy code
LaunchPlan.get_or_create(
    name="my_launchplan",
    workflow=wf,
    schedule=CronSchedule(
        schedule="0 6 * * MON#1",  # UTC, see <https://docs.flyte.org/en/latest/concepts/schedules.html#cron-expression-table>
    )
)
but running it directly with Python doesn't seem to do anything. I've tried
pyflyte launchplan
and
pyflyte run --remote
, but neither seems to support this use case. Any help would be much appreciated! 🙏 (I'm running the example from here: https://github.com/flyteorg/flytesnacks/blob/0ec8388759d34566a0ffc0c3c2d7443fd4a3a46f/examples/basics/basics/launch_plan.py) # Answer To create a launch plan programmatically in Flyte, you should use the
LaunchPlan.get_or_create()
method, which is designed to create or retrieve a launch plan for a given workflow. However, simply running this code in Python won't register the launch plan with Flyte. You need to register it using the
pyflyte register
command. According to the Flyte documentation, the registration process involves specifying the project, domain, and version. The cron expression
0 6 * * MON#1
is not supported by Flyte's cron parser, as noted in this GitHub issue. You should modify it to a supported format, such as
0 6 1-7 * MON
for the first Monday of the month. Would you like more detail on how to register and activate the launch plan? Sources: - Flyte documentation - this GitHub issue Slack Link https://.slack.com/archives/CP2HDHKE1/p1730726743.641129 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.