Hello, I am new to Flyte. I’ve setup flyte locally...
# flyte-support
s
Hello, I am new to Flyte. I’ve setup flyte locally and started the demo cluster. I created a launch plan below. How do I register it and activate it so that it will show up in the UI? The found the documentation not clear about LP registration. Thank yiou!
Copy code
from flytekit import LaunchPlan, current_context, task, workflow

@task
def square(val: int) -> int:
    return val * val

@workflow
def my_wf(val: int) -> int:
    result = square(val=val)
    return result

default_lp = LaunchPlan.get_default_launch_plan(current_context(), my_wf)
square_3 = default_lp(val=3)
Hi @glamorous-carpet-83516, Do you have any advices?
g
If you want to create a new launch plan, you can use
LaunchPlan.get_or_create
.check this doc
s
Thanks @glamorous-carpet-83516. I changed the method to LaunchPlan.get_or_create() in the script. But how do I register the launch plan and then make it available in the system / UI?
Which command will do that?
g
pyflyte register example.py
. it will register your LP.
s
I registered the LP and can see the LP in UI. However, there is no execution and I cannot kick off a run manually from UI.
And I am confused about the
Copy code
kickoff_time_input_arg="kickoff_time"
in
Copy code
schedule=CronSchedule(
        schedule="*/1 * * * *",  
        kickoff_time_input_arg="kickoff_time",
    )
g
hmm, could you share a screenshot? should be able to launch it.
s
message has been deleted
How do I create new execution?
g
message has been deleted
launch workflow button
s
Thanks. However, I don’t observe the 1 minute cron schedule is being followed.
It only ran once.
g
is flyte scheduler in your cluster?
s
I don’t have kube running locally. I have the demo cluster running docker.
flyte-sandbox
g
sorry, flyte scheduler isn’t enabled in demo cluster. could you try
flytectl sandbox start
instead
s
Thank you @glamorous-carpet-83516!
t
@glamorous-carpet-83516, flyte scheduler should work on demo. I tried running it a few days ago.
@salmon-refrigerator-32115, what are the commands you ran to register and schedule your launch plan?
s
Hi @tall-lock-23197, thank you for reaching out. my code to create the LP is like
Copy code
@workflow
def my_wf(
    # kickoff_time: datetime, 
    val: int
    ) -> int:
    # print(f"datetime run: {kickoff_time}")
    result = square(val=val)
    return result

schedule = CronSchedule(
    schedule="*/1 * * * *",
    # kickoff_time_input_arg="kickoff_time"
)

lp = LaunchPlan.get_or_create(
    workflow=my_wf, name="lp_test_1", schedule = schedule, default_inputs={"val": 3}
)
To register I used
Copy code
pyflyte register lp-test-1.py
I can see the LP is shown in the UI
However, there is no executions.
And it says This workflow has no schedules.
I tried sandbox cluster and it looks the same.
t
I think you missed activating the launch plan:
Copy code
flytectl update launchplan -p flytesnacks -d development <lp-name> --version <version> --activate
👍 1
s
Hi @tall-lock-23197, Yea, it worked after activating the launch plan. Thank you so much!
158 Views