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

Jelle Vegter

04/11/2022, 2:14 PM
Hi, do jobs sent to a local agent run in the terminal the agent is listening from? Meaning the job can access a cli authentication and environment variables?
k

Kevin Kho

04/11/2022, 2:16 PM
Yes but you can also pass in env vars through the agent using the
--env VAR=VALUE
flag when spinning the agent up
j

Jelle Vegter

04/11/2022, 2:17 PM
thanks
I’m asking because I have a flow which imports a main function from a local package
I put the entire main function in a task and schedule that through prefect cloud
If I run the function from the terminal where the agent listens from the main function works fine. However when I schedule it, it doesn’t run
The function takes ~20 minutes. I get this error:
Any tips?
a

Anna Geller

04/11/2022, 2:18 PM
you can attach a path to your agent this way:
Copy code
prefect agent local start -p /Users/your_username/path/to/your_modules
for more information on this, check this Discourse topic https://discourse.prefect.io/t/when-i-run-my-flow-i-see-an-error-failed-to-load-and-exe[…]derror-no-module-named-users-username-what-is-happening/33
j

Jelle Vegter

04/11/2022, 2:19 PM
I have no issues importing local modules (I use Poetry as package manager)
👍 1
a

Anna Geller

04/11/2022, 2:20 PM
and regarding the heartbeat error, this topic shows some steps you may take to fix it https://discourse.prefect.io/t/flow-is-failing-with-an-error-message-no-heartbeat-detected-from-the-remote-task/79
j

Jelle Vegter

04/11/2022, 2:20 PM
Great, thanks!
👍 1
7 Views