Hi guys. tell me, on my computer .py flow.run is e...
# ask-community
k
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
Hi @Konstantin - can you provide some more information about your flow? What storage / agent are you using for your flow?
k
@nicholas prefect server core version 0.15.1, storage local, manage local agents.
n
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
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
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
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
thanks