Question

What code needed for App Platform "Worker"

I’m trying to make code that will run one method in my App Platform Django project every 15 minutes. According to the D.O. docs a Worker resource can do this.

However, after scouring the internet for hours I can’t find any documentation about how this code is run, if it needs to be it’s own python process, how the worker is configured or any other basic information on how these are supposed to work.

Ideally I can just say “run this method” on my existing App Platform app and be done with it. If needed I’m fine with sending a network request to start the method (without a response according to the Worker documentation).

I just need somewhere to start. I have no idea how to code something the worker can even use.


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 6, 2023

Hi there,

Background workers can consist of any application code you like. As far as App Platform is concerned, they are the same as services, except they are not “routable,” i.e. they are not accessible via an external URL.

It sounds like for your use case, it might be better to use a serverless function and schedule it so it runs on specific times:

https://docs.digitalocean.com/products/functions/how-to/schedule-functions/

Best,

Bobby