https://prefect.io logo
Title
j

John O'Farrell

05/18/2022, 6:14 PM
Hello, I was trying to test getting a local flow up and running. Was able to successfully register and run it using the prefect cloud ui, but I tried switching to using the
prefect.Client
api to run the task and it threw an error
Failed to load and execute flow run: TypeError("'ABCMeta' object is not subscriptable")
. Now any subsequent attempt to run the flow using the prefect ui throws the same error, even though the code hasn't changed.
k

Kevin Kho

05/18/2022, 6:15 PM
Are you on Cloud or Server? How did you use the
prefect.Client
?
j

John O'Farrell

05/18/2022, 6:29 PM
Prefect cloud. I ran
client = prefect.Client(api_key='{key}')
client.create_flow_run(flow_id='{flow_id}')
k

Kevin Kho

05/18/2022, 6:32 PM
Does the flow actually get picked up by an agent and start? I think something is off with the flow definition here. Would you be able to share it?
j

John O'Farrell

05/18/2022, 6:35 PM
This is the log of the agent
[2022-05-18 18:32:36,501] INFO - agent | Deploying flow run {flow} to execution environment...
INFO:agent:Deploying flow run {flow} to execution environment...
[2022-05-18 18:32:36,717] INFO - agent | Completed deployment of flow run {flow}
INFO:agent:Completed deployment of flow run {flow}
[2022-05-18 18:33:07,669] INFO - agent | Process PID 15752 returned non-zero exit code 1!
INFO:agent:Process PID 15752 returned non-zero exit code 1!
But what I think might be the problem is that I'm realizing now that it doesn
doesn't seem like it's actually storing anything in
\.prefect\flows
when I register it now
k

Kevin Kho

05/18/2022, 6:37 PM
Are you using the CLI? Maybe because there was no change. You can use the
--force
flag to force the registration
j

John O'Farrell

05/18/2022, 6:38 PM
I'm registering and launching the agent in python
k

Kevin Kho

05/18/2022, 6:40 PM
Did you define a storage?
j

John O'Farrell

05/18/2022, 6:42 PM
This is the code that I've been using to register
flow.storage = Local(path='<http://src.app|src.app>', stored_as_script=True) flow.register(project_name="ingestion-pipeline")
k

Kevin Kho

05/18/2022, 6:44 PM
This is pointing already to an existing file, which is why it wont serialize and write in the
.prefect
folder anymore. You path should be the Python file though
Oh is
<http://src.app|src.app>
a module or folder?
j

John O'Farrell

05/18/2022, 6:45 PM
It's a module, app.py is where the flow is defined
k

Kevin Kho

05/18/2022, 6:46 PM
Ah that looks right then I think. You could try the default pickle storage though to see if storage is the problem here
j

John O'Farrell

05/18/2022, 6:49 PM
When I try using the pickle storage is throws an error
cannot pickle '_thread.lock' object
. That's why I had been using local stoage and making sure it knows it's stored as a script
k

Kevin Kho

05/18/2022, 6:53 PM
Ah ok. I assume you know why that happens. To the original error, nothing really rings a bell but you can try absolute path over module to see if that helps
j

John O'Farrell

05/18/2022, 7:05 PM
Wait is
\.prefect\flows
only supposed to be used if
stored_as_script=False
k

Kevin Kho

05/18/2022, 7:07 PM
Yes that is the default location. But if you provide path=… and stored_as_script=False, it will save it there