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

Garret Cook

01/29/2024, 6:24 PM
Hey Team, I'm attempting to use an example from the documentation:
Copy code
from flytekit import LaunchPlan

flyte_workflow = remote.fetch_workflow(
    name="my_workflow", version="v1", project="flytesnacks", domain="development"
)
launch_plan = LaunchPlan.get_or_create(name="my_launch_plan", workflow=flyte_workflow)
And I cannot get it to work. I get this error when I try to pyflyte register the code:
Copy code
AttributeError: 'NoneType' object has no attribute 'inputs'
I believe it may be described here: https://github.com/flyteorg/flytekit/pull/1252 Should this work? I assume so, because it is in the examples? Can anyone help clarify what the issue might be?
h

Haytham Abuelfutuh

01/29/2024, 7:58 PM
I see the name is not correct here:
Copy code
flyte_workflow = remote.fetch_workflow(
    name="my_workflow", version="v1", project="flytesnacks", domain="development"
)
It should be:
Copy code
flyte_workflow = remote.fetch_workflow(
    name="my_remote_wf", version="v1", project="flytesnacks", domain="development"
)
It should match the name of the workflow you are trying to fetch. does that help?
g

Garret Cook

01/29/2024, 7:59 PM
It does help, though I already made the correction in my code assuming that part was a typo, still getting the error.
h

Haytham Abuelfutuh

01/29/2024, 8:01 PM
CC @Kevin Su @Yee
k

Kevin Su

01/29/2024, 8:33 PM
does your workflow have inputs
g

Garret Cook

01/29/2024, 8:34 PM
Yessir
y

Yee

01/29/2024, 8:40 PM
can you paste the signature of the workflow?
if a remote workflow doesn’t have inputs, then you should be able to create a launch plan for it without knowing the python interface.
g

Garret Cook

01/29/2024, 8:41 PM
@workflow def send_emails_via_o365(to:List[str], bcc:List[str], mime_body:List[FlyteFile])
y

Yee

01/29/2024, 8:42 PM
but if it has inputs, then those inputs are typically specified when you create the new launchplan, and the flytekit engine needs the python types to convert from python values to flyte values
g

Garret Cook

01/29/2024, 8:45 PM
That is very helpful. Is there a way I should be providing the python types, or are you saying that is just not a supported method at this time?
y

Yee

01/29/2024, 8:46 PM
it should be supported, esp in this case.
cuz you’re not providing any values right?
they’re all required inputs at launch time.
g

Garret Cook

01/29/2024, 8:47 PM
No values are supplied in the workflow definition, they are intended (and required) to be specified at launch time.
I've just been trying different variations, and it appears I can get what I need pulling the existing default launch plan, and executing it:
Copy code
send_emails_via_o365_lp = remote.fetch_launch_plan(name="workflows.send_email_via_o365.send_emails_via_o365")
    execution = remote.execute(send_emails_via_o365_lp, inputs={"to":[], "bcc": [], "mime_body": []})
Where those blank lists are lists of data typically, but it works with the blank lists too. **Edited - Nevermind, it does NOT work with dynamic lists of data, I was mistaken.
y

Yee

01/29/2024, 8:52 PM
let me dig some more this afternoon
g

Garret Cook

01/30/2024, 1:50 AM
Using a reference workflow seems to work like a treat. Followed this guide, need some more testing, but looks promising.
4 Views