[SOLVED] Scheduled jobs (server side)

Is there some way to run a server module as a scheduled process (eg to run every 30 minutes) on the server side?
The equivalent to a cron job

Admin note: This is now available! Check out Anvil’s Scheduled Tasks

5 Likes

Good question! Not at the moment. Right now you would need a cron job elsewhere pointing at an HTTP endpoint to trigger the tasks.

Scheduled Tasks are on our list to implement, so watch this space.

[Moving to Feature Requests category]

2 Likes

Thanks for the suggestion that should work

Would be great to have this feature :slight_smile:

Hi all,

New to the Anvil community (and anvil) but loving the fact that I have basically found windows form designer for web available in the lovely language that is python! I was wondering if you would be able to help me with a query.

I am writing a little test app that relies on some APIs. The API takes a little time to run through the list I have. I am using the server module to run the external API using the requests library. What I was wondering was is there a way to set it off with the data and then let the client continue on with the app while that goes in the background processing?

Thanks

Hi @chrislarge305, and welcome to the forum!

I’m merging this with the feature request for scheduled tasks, because these are basically part of the same feature for us (scheduled tasks have to run in the background!).

Right now, the best way to do concurrent background processing is to use the Uplink to set off (and then collect the results from) a background thread.

Is there a tutorial on doing this? About to become critical for me.

I’m using this method to trigger a couple of regular jobs. I use UptimeRobot to ping the endpoint for free on a schedule.

2 Likes

Still prefer an integrated feature, but got this working with HTTP endpoints and https://www.setcronjob.com/ instead of https://uptimerobot.com/

https://www.setcronjob.com/ lets me set exact time to run a task, including setting a time zone, and logs the output, so i can check output and review results.

1 Like

Hi All,

Has there been any update on this feature request? Its pretty critical for me and I imagine many others - note that this was proposed JUL 2017 - is it dead now?

Yep :

https://anvil.works/docs/background-tasks/scheduled-tasks

and

https://anvil.works/docs/background-tasks

Been available for a while now.

2 Likes

As David says.

Also, available on individual plan or higher.

Tutorial:

2 Likes

appreciate the quick response, I find myself getting lost in the documentation with some of these things - should this not be closed/solved?

Might take Anvil Central to mark this as solved as it’s in the feature requests rather than Q&A.

(and yeah, if you miss the announcements it can be quite easy for new features to pass you by)

Mods can close issues (the :wrench:) but I usually don’t in case Anvil central prefers it to stay open. In this case, yes, I’ll close it as it makes sense.

3 Likes