Hey Team, I'm attempting to use an example from <...
# ask-the-community
g
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
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
It does help, though I already made the correction in my code assuming that part was a typo, still getting the error.
h
CC @Kevin Su @Yee
k
does your workflow have inputs
g
Yessir
y
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
@workflow def send_emails_via_o365(to:List[str], bcc:List[str], mime_body:List[FlyteFile])
y
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
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
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
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
let me dig some more this afternoon
g
Using a reference workflow seems to work like a treat. Followed this guide, need some more testing, but looks promising.