<I was studying the launch plan concept on this pa...
# ask-the-community
d
I was studying the launch plan concept on this page. I have a few questions. Let us say I want to define a corn job using flyte. I have to register a workflow and then a launch plan with a schedule for the same workflow.
Copy code
from flytekit import CronSchedule, LaunchPlan  # noqa: E402
from train_model_workflow import train
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config

remote = FlyteRemote(
    config=Config.auto(config_file="../config.yaml"),
    default_project="flytesnacks",
    default_domain="development",
)

cron_lp = LaunchPlan.get_or_create(
    name="train-cron",
    workflow=train,
    fixed_inputs={"tokenizer": ""},
    schedule=CronSchedule(
        schedule="*/5 * * * *",
    ),
)
print(cron_lp)

f_cron_lp = remote.register_launch_plan(
    cron_lp,
    version="1707840433",
    project="flytesnacks",
    domain="development",
)
print(f_cron_lp)

remote.activate_launchplan(f_cron_lp.id)
• Are launch plans "deactivated" by default? I had to call
activate_launchplan
method. After that, the corn jobs started executing. • I understand only one launch plan version can be active. Assume I had launch plan v4 already activated, and now I created v5. Will v5 automatically become the new active launch plan? Or do I have to deactivate v4 and then activate v5?
y
you have to manually activate v5 yes.
simply registering will not activate it.
this was a design decision made a while back, i don’t remember the exact reason, but i think we felt it was safer.
however activating v5 will automatically deactivate v4, you don’t have to do that separately