Hello everyone, I noticed something strange today ...
# ask-community
i
Hello everyone, I noticed something strange today and I don't know if it was a bug or not. I had registered a Flow using the API and started an agent at the same folder using the CLI. The Flow was schedule to Run on the Prefect Cloud and I did some "Quick Runs" to test/debug. Everything was running fine, however, the VM that I'm running the Agent was shut down for maintenance on the weekend, and I restarted the agent again (now in a different folder than before) an received 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 \'Submodules\'",)\nThis may be due to a missing Python module in your current environment. Please ensure you have all required flow dependencies installed.',)
The error was solved after shutting down the agent and starting again at the same folder of his first execution. I think this is related to the agent metadata, is this behavior normal?
k
Hey @Italo Barros, this behavior is normal. The default working directory of the LocalAgent is the directory is was started in. It can be changed though by specifying
working_dir
in the Run Configuration like this .
❤️ 1
i
Thank you @Kevin Kho, I will take a look into it! Quick question, is possible to restart a Local Agent automatically if the machine was shut down or just restarted?
k
You need to use something other than Prefect. Check this
❤️ 1