y

    Yusuf Khan

    9 months ago
    I have a use case where I have some equipment in a lab and connected to a desktop. I wanted to use Prefect to schedule a shell task to run on the machine that backs up its data to blob storage and then other downstream tasks are fired off. I walked through and did examples from a decent chunk of the documentation yesterday. I'm a little bit unclear on best practices for agents. Are they supposed to be on all the time? So in the given example the desktop will sometimes be on, sometimes be off. Do I just need to set the machine to start the agent on bootup or can that behavior be controlled from within prefect? Additionally, for best practice, if I have several of these machines like this would it be better to put an agent on each machine, or to setup one 'staging' cloud vm, and then run the agent there and execute tasks that live on the remote machines, but via ssh commands from the cloud vm?
    Anna Geller

    Anna Geller

    9 months ago
    @Yusuf Khan correct, agents are supposed to run 24/7. You can use e.g. supervisor to keep a local or Docker agent running. A best practice would be to assign a unique label to each of those agents. This page explains how to do it: https://docs.prefect.io/orchestration/agents/local.html#multiple-local-agents-with-the-same-label