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

Pranit

09/13/2022, 6:07 PM
Also how to keep agent for prefect 2.0 keep on running in background. Apprently as soon as I close my session, all my scheduled jobs go into late mode. not sure why
prefect agent start -q 'default'
1
c

Christopher Boyd

09/13/2022, 6:17 PM
Hi Pranit, this should be able to help if you are running in Linux https://discourse.prefect.io/t/how-to-run-a-prefect-2-agent-as-a-systemd-service-on-linux/1450
a

Alexey Stoletny

09/13/2022, 6:27 PM
yep @Pranit we user supervisor
p

Pranit

09/15/2022, 6:14 AM
I have used the above article and agent is running in backgrounf
but still not picking up job until I manyally hit prefect agent command on local cmd
c

Christopher Boyd

09/15/2022, 2:00 PM
I dont understand what you mean
p

Pranit

09/15/2022, 2:01 PM
no worries
I got it resolved
🙌 1
s

Sven Aoki

09/15/2022, 2:42 PM
Does this require all packages, which you've used in your flow/tasks, to be installed globally on the VM!? Isn't it weird that even when using the cloud version, that the orchestration depends on running the agent in the local terminal session? Another option would be to run the agent in docker on the VM. Here the Dockerfile is just the official Prefect image, and pip installed all libraries which are used in the flow/tasks
services:
prefect-agent:
container_name: prefect_agent_cloud
build:
context: ./agent
command:
- prefect
- agent
- start
- 'your_queue_name'
environment:
PREFECT_API_URL: you_url
PREFECT_API_KEY: your_key
PREFECT_LOGGING_LEVEL: DEBUG
DOCKER_HOST: <unix://var/run/docker.sock>
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: on-failure
3 Views