Hello, I was trying to test getting a local flow u...
# prefect-community
j
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
Are you on Cloud or Server? How did you use the
prefect.Client
?
j
Prefect cloud. I ran
client = prefect.Client(api_key='{key}')
client.create_flow_run(flow_id='{flow_id}')
k
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
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
Are you using the CLI? Maybe because there was no change. You can use the
--force
flag to force the registration
j
I'm registering and launching the agent in python
k
Did you define a storage?
j
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
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
It's a module, app.py is where the flow is defined
k
Ah that looks right then I think. You could try the default pickle storage though to see if storage is the problem here
j
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
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
Wait is
\.prefect\flows
only supposed to be used if
stored_as_script=False
k
Yes that is the default location. But if you provide path=… and stored_as_script=False, it will save it there