https://flyte.org logo
#ask-the-community
Title
# ask-the-community
c

Chris Hairfield

10/12/2022, 9:26 PM
Hello 👋, I recently joined a team using Flyte, and I’m tasked with introducing Flyte’s native scheduler. I’ve gotten my code running in the
sandbox
environment with
--fast
registration, which is pretty awesome. But now I’m stuck trying to set inputs specific to developing in
sandbox
(e.g., hostname of an external service running on my local machine). Question: How do I enable a schedule with specified inputs that override
default_inputs
whenever the scheduler invokes my workflow? What I think I want is a commandline like:
Copy code
flytectl update launchplan -p {project} -d {domain} {lp_name} --version {version} --activate --execFile exec_spec.yaml
As a test, when I try to follow this line from the docs and omit a required input from the
LaunchPlan.get_or_create
call, then my schedule simply doesn’t run when actived:
Copy code
Launch plans do not necessarily contain the entire set of required workflow inputs
I hope I’m just missing something! Thanks.
y

Yee

10/12/2022, 10:41 PM
you cannot. you will need to create a new launch plan with the inputs you want.
but that should be pretty doable. is there a problem with that?
c

Chris Hairfield

10/12/2022, 11:22 PM
gotcha, good to know
it certainly won’t be a major problem, if at all, but I’ll have to take some time structuring my code around this to know for sure
y

Yee

10/12/2022, 11:23 PM
wait why?
i’m confused.
making a new launch plan is just one line…
c

Chris Hairfield

10/12/2022, 11:24 PM
so while I can make multiple launch plans, I don’t want to check a sandbox-specific one into my team’s repo
y

Yee

10/12/2022, 11:24 PM
can you paste the signature of the wf
c

Chris Hairfield

10/12/2022, 11:24 PM
it’s not a hard requirement, but I like to keep that sort of thing in READMEs and scripts
Copy code
@workflow
def wf(ip: str, args: List[str]):
    prepared = prepare_map_inputs(args=args, ip=ip)
    return map_task(task_name)(input=prepared)
y

Yee

10/12/2022, 11:27 PM
you want a launch plan that is only registered on sandbox not in production?
c

Chris Hairfield

10/12/2022, 11:27 PM
I’d like a different one between the two environments, yeah
my prod one is daily and uses kubernetes to access the external service, and for sandbox I run that service on my machine (outside docker) and want a shorter schedule for testing purposes
y

Yee

10/12/2022, 11:28 PM
and you tried creating one manually out of band?
and you’re saying the creation worked.. but schedule activation failed?
c

Chris Hairfield

10/12/2022, 11:28 PM
I’ve been able to create one with FlyteRemote
y

Yee

10/12/2022, 11:28 PM
can you paste in the get or create call as well?
c

Chris Hairfield

10/12/2022, 11:30 PM
Copy code
launch_plan = LaunchPlan.get_or_create(
    workflow=wf,
    name="lp",
    default_inputs={
        "args": ["arg1", "arg2"],
        "ip": "<http://kubernetes-host:8080>",
    },
    schedule=CronSchedule(
       schedule="*/1 * * * *", # a testing schedule of 1 minute
    ),
)
y

Yee

10/12/2022, 11:31 PM
may be a bug… but can you try changing that to fixed_inputs?
c

Chris Hairfield

10/12/2022, 11:31 PM
In sandbox, I’d ideally like to override args (says with fewer elements) and ip (with
"<http://host.docker.internal:8080>"
)
y

Yee

10/12/2022, 11:31 PM
sure but that can be yet another launch plan right?
since there’s no way to override inputs for a scheduled one
may as well be fixed.
c

Chris Hairfield

10/12/2022, 11:32 PM
I see what you’re saying, I’ll change it to fixed to make it clear in the code and find a clean way to create a specific launch plan for sandbox
luckily, the above get_or_create call does work if I set the appropriate values in the code
it only broke when I tried to override the inputs, which isn’t supported
I have a few ideas of how to proceed from here, so thanks for the pointers - I’ll toy around with them tomorrow
y

Yee

10/12/2022, 11:34 PM
yeah sure, let us know
c

Chris Hairfield

10/12/2022, 11:35 PM
ok, and thanks again for all your work on the sandbox environment 🙂
72 Views