Also how to keep agent for prefect 2.0 keep on run...
# prefect-community
p
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
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
yep @Pranit we user supervisor
p
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
I dont understand what you mean
p
no worries
I got it resolved
🙌 1
s
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