https://prefect.io logo
Title
a

Andy Dienes

04/10/2023, 2:46 AM
I'm playing with a free account on Prefect Cloud. I put a very simple test job up and they're both "late" to run, and it looks like my work pool is stuck in
unhealthy
. is there anything I can do to fix this, or is it just because I have a very new / unpaid account?
r

redsquare

04/10/2023, 6:44 AM
There is an issue with your agent not polling to pick up the jobs
a

Andy Dienes

04/10/2023, 12:54 PM
I see. I ran exactly the steps given in the getting started page when I made the account, so just
from prefect import flow
from prefect.deployments import Deployment

@flow(log_prints=True)
def hi():
    print("Hi from Prefect! 🤗")

def deploy():
    deployment = Deployment.build_from_flow(
        flow=hi,
        name="prefect-example-deployment"
    )
    deployment.apply()

if __name__ == "__main__":
    deploy()
are these steps outdated?
a

Adam

04/10/2023, 12:55 PM
did you start the agent by doing something like this
prefect agent start --pool default-agent-pool
I def missed this step when I first tried a deploy
a

Andy Dienes

04/10/2023, 12:56 PM
ah, ok so I ran that and I can see up in the UI that the jobs completed successfully
I don't quite understand though --- I thought the point of Prefect Cloud is that the jobs don't run locally?
I am trying to set up a very simple "productionized cron." will I always have to have an agent running locally?
a

Adam

04/10/2023, 1:10 PM
This is the fun I am going through, you can keep the agent on your local machine, however it has the potential to stop if the computer gets shut down. Other option is to run the agent on a virtual machine that's always on and then the cron job should work. If you go that route I would make an automation on the agent health to make sure its on. the automation can alert you if the working pool goes unhealthy due to the agent going dormant.
a

Andy Dienes

04/10/2023, 1:15 PM
thank you for the insight. I guess I still am missing something though: I thought the point of paying for a service like Prefect Cloud is that I wouldn't have to think about resiliency like that so much? does everybody who uses this have their own agent running somewhere and just make sure it never turns off?
r

redsquare

04/10/2023, 1:31 PM
Prefect just looks after the scheduling of your flows that run on your own infrastructure
Currently you heed to host the agent(s) and the flow infra
a

Andy Dienes

04/10/2023, 1:47 PM
I see. at that point I may as well just host the scheduler myself too then lol. I'll try it out, thanks for the tips
r

redsquare

04/10/2023, 3:05 PM
Well I suspect hosted agents and runners will be on their roadmap pretty soon. The cloud version does have benefits currently such as workspaces and better security etc
a

Adam

04/10/2023, 3:10 PM
the blocks are nice for creds and docker. Also automations to make sure your stuff doesnt fail silently.
:upvote: 2
r

redsquare

04/10/2023, 3:10 PM
yeah forgot automations 👍