https://prefect.io logo
#prefect-server
Title
# prefect-server
j

Jovan Sakovic

10/28/2021, 1:29 PM
Hi everyone 👋 I’m trying to run a Flow locally, with a local agent and can’t get it past the “Submitted for execution” state.. Tried a lot of different stuff: • shutting down the agent (though this seems like something not very well documented, please correct me if I’m wrong) • matching the labels of the agent and the flow • switching things up with the environment variables (and Secret()) In the agent logs this is the error I get. The messed up thing is that everything was running smoothly 2 days ago..
k

Kevin Kho

10/28/2021, 1:30 PM
Hey @Jovan Sakovic, maybe running with debug level logs on the agent would help. Hard to tell but it’s definitely not the labels cuz the agent is picking it up.
j

Jovan Sakovic

10/28/2021, 1:34 PM
Hi @Kevin Kho, thanks for the tip Though not much different is logged
Copy code
[2021-10-28 13:32:07,457] DEBUG - agent | Sleeping flow run poller for 10.0 seconds...
[2021-10-28 13:32:17,461] DEBUG - agent | Querying for ready flow runs...
[2021-10-28 13:32:17,708] DEBUG - agent | Found 1 ready flow run(s): {'5feb1d2a-c0c9-48b0-9318-fcd6a38e0b14'}
[2021-10-28 13:32:17,708] DEBUG - agent | Retrieving metadata for 1 flow run(s)...
[2021-10-28 13:32:17,925] DEBUG - agent | Submitting flow run 5feb1d2a-c0c9-48b0-9318-fcd6a38e0b14 for deployment...
[2021-10-28 13:32:17,932] INFO - agent | Deploying flow run 5feb1d2a-c0c9-48b0-9318-fcd6a38e0b14 to execution environment...
[2021-10-28 13:32:17,932] DEBUG - agent | Sleeping flow run poller for 0.25 seconds...
[2021-10-28 13:32:17,932] DEBUG - agent | Updating flow run 5feb1d2a-c0c9-48b0-9318-fcd6a38e0b14 state from Scheduled -> Submitted...
[2021-10-28 13:32:18,186] DEBUG - agent | Querying for ready flow runs...
[2021-10-28 13:32:18,215] DEBUG - agent | Submitted flow run 5feb1d2a-c0c9-48b0-9318-fcd6a38e0b14 to process PID 1398
[2021-10-28 13:32:18,216] INFO - agent | Completed deployment of flow run 5feb1d2a-c0c9-48b0-9318-fcd6a38e0b14
[2021-10-28 13:32:18,465] DEBUG - agent | No ready flow runs found.
[2021-10-28 13:32:18,466] DEBUG - agent | Sleeping flow run poller for 0.5 seconds...
...
...
[2021-10-28 13:32:45,370] DEBUG - agent | Sleeping flow run poller for 10.0 seconds...
[2021-10-28 13:32:48,359] DEBUG - agent | Sending agent heartbeat...
[2021-10-28 13:32:48,360] INFO - agent | Process PID 1398 returned non-zero exit code 1!
[2021-10-28 13:32:48,360] DEBUG - agent | Heartbeat succesful! Sleeping for 60.0 seconds...
[2021-10-28 13:32:55,371] DEBUG - agent | Querying for ready flow runs...
[2021-10-28 13:32:55,584] DEBUG - agent | No ready flow runs found.
[2021-10-28 13:32:55,584] DEBUG - agent | Sleeping flow run poller for 10.0 seconds...
k

Kevin Kho

10/28/2021, 1:34 PM
I assume the flow doesnt start right? What is the state in the UI?
j

Jovan Sakovic

10/28/2021, 1:35 PM
Correct. “Submitted for execution:
k

Kevin Kho

10/28/2021, 1:35 PM
Do you know if this is flow specific or all flows?
j

Jovan Sakovic

10/28/2021, 1:37 PM
Let me try a very simple example flow Had the same issue with a different flow an hour ago, fiddled around with agents and it worked out. Though I guess it was just a lucky shot
k

Kevin Kho

10/28/2021, 1:39 PM
If the simple one fails, you probably need to check that server containers are all alive.
upvote 1
j

Jovan Sakovic

10/28/2021, 1:45 PM
Okay, running the simple one gets us a step closer In my project, I have a prefect directory. In it there’s a script with a flow, and another slack_metadata script. The latter is imported in the flow script. Because of this, I’ve been getting the following error:
Copy code
Failed to load and execute Flow's environment: FlowStorageError('An error occurred while unpickling the flow:\n ModuleNotFoundError("No module named \'slack_metadata\'")\nThis may be due to a missing Python module in your current environment. Please ensure you have all required flow dependencies installed.')
To get around that, I made a
__init__.py
in the prefect directory (where the flow and metadata script are). Now, after trying the simple example, I assume that prefect saw the prefect directory as the prefect module, and could not import any of the prefect imports..
At least now the flow starts again, but cancels because of the import. Is there a way to have the metadata script included?
k

Kevin Kho

10/28/2021, 1:50 PM
Yeah you can start your agent in the same directory where it is importable, or use the
LocalRun
RunConfig that lets you choose a working directory to run the flow. If that init ends up not being called, I guess you would need an explicit import. I’m not sure it will be called.
🎯 1
❤️ 1
j

Jovan Sakovic

10/28/2021, 1:54 PM
That’ll do it.. Thank you!