I'm playing with a free account on Prefect Cloud. ...
# prefect-cloud
a
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
There is an issue with your agent not polling to pick up the jobs
a
I see. I ran exactly the steps given in the getting started page when I made the account, so just
Copy code
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
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
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
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
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
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
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
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
the blocks are nice for creds and docker. Also automations to make sure your stuff doesnt fail silently.
upvote 2
r
yeah forgot automations 👍