https://prefect.io logo
k

Konstantin

08/27/2021, 6:55 AM
Hi guys. tell me, on my computer .py flow.run is executed without errors. But if I register my_flow.py on the server, then the following error appears in the logs:
6 August 2021,10:31:49 	agent01	INFO	Submitted for execution: PID: 135
26 August 2021,10:31:49 	agent03	INFO	Submitted for execution: PID: 140
26 August 2021,10:31:49 	agent02	INFO	Submitted for execution: PID: 136
26 August 2021,10:31:49 	execute flow-run	ERROR	Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/Users/user1/'")
26 August 2021,10:31:49 	execute flow-run	ERROR	Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/Users/user1/'")
26 August 2021,10:31:49 	execute flow-run	ERROR	Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/Users/user1/'")
tell me where to look for the error
n

nicholas

08/27/2021, 7:07 AM
Hi @Konstantin - can you provide some more information about your flow? What storage / agent are you using for your flow?
k

Konstantin

08/27/2021, 7:17 AM
@nicholas prefect server core version 0.15.1, storage local, manage local agents.
n

nicholas

08/27/2021, 7:25 AM
When you say local agents, does that mean the agent that's submitting the run is running on your local machine (or wherever the flow was registered?)
k

Konstantin

08/27/2021, 7:40 AM
Copy code
locally in the IDE 'Pycharm' my_flow.py, if you comment out the line flow.regster (), add the line flow.run () starts and runs successfully. But when I run (run with the line flow.register ()) my_flow.py on the server prefect. The scheduled launch of my flow on the server fails. The remote server is deployed under docker containers (prefect, hasura, postgres, etc.), agents on the host are also running in the container (prefect agent local start)
"When you say local agents, does that mean the agent that's submitting the run is running on your local machine (or wherever the flow was registered?)" - wherever the flow was registered
@nicholas "When you say local agents, does that mean the agent that's submitting the run is running on your local machine (or wherever the flow was registered?)" - wherever the flow was registered
@nicholas I understand that it is necessary to specify the source of the flow storage on the remote server?
Copy code
storage = Local(add_default_labels=False, path="~/.prefect/flows/myflow.py", stored_as_script=True)
    with Flow('LoadData_inGreenPlum_fromHunterFlow', schedule, storage=storage) as flow:
w

Wilson Bilkovich

08/27/2021, 1:21 PM
You’ll need to use an Agent running on your actual local machine, if you want to use Local storage, at least as far as I understand.
k

Kevin Kho

08/27/2021, 1:50 PM
Hey @Konstantin, the local agent starts the flow by grabbing that file from a local directory and then running it. Here, your agent is not able to find the script. The agent needs to be able to load the script at the given path. The agent and flow need to be on the same machine for
Local
storage Also, the agent might be starting in a directory that doesn’t have access to that flow. Try starting that agent in the same directory you registered from.
1
upvote 1
k

Konstantin

08/27/2021, 2:43 PM
thanks
2 Views