Workers - Cron triggers are now supported in Python Workers
1y ago
Source
CloudflareWorkers - Cron triggers are now supported in Python Workerscloudflare.comYou can now create Python Workers which are executed via a cron trigger. This is similar to how it's done in JavaScript Workers, simply define a scheduled event listener in your Worker: from workers import handler @ handler async def on_scheduled ( event , env , ctx ): print ( "cron processed" ) Define a cron trigger configuration in your Wrangler configuration file: wrangler.jsonc { " triggers " : { // Schedule cron triggers: // - At every 3rd minute // - At 15:00 (UTC) on first day of the month // - At 23:59 (UTC) on the last weekday of the month " crons " : [ "*/3 * * * *" , "0 15 1 * *" , "59 23 LW * *" ] } } wrangler.toml [ triggers ] crons = [ "*/3 * * * *" , "0 15 1 * *" , "59 23 LW * *" ] Then test your new handler by using Wrangler with the --test-scheduled flag and making a request to /cdn-cgi/handler/scheduled?cron=*+*+*+*+* : npx wrangler dev --test-scheduled curl " Consult the Workers Cron Triggers page for full details on cron triggers in Workers.
You might also wanna read
Making Cronjobs More Dynamic with Wrapper Scripts
The article discusses a technique for making cronjobs more dynamic and flexible by using wrapper scripts that can conditionally execute task
FastScheduler: Decorator-First Python Task Scheduler with Cron, Interval, and Timezone Support
FastScheduler is a Python task scheduling library that provides a decorator-first approach for scheduling cron, interval, and one-time jobs.
Cronboard: Terminal Dashboard for Managing Cron Jobs on Local and Remote Servers
Cronboard is a terminal-based dashboard application for managing cron jobs on both local and remote servers. The tool allows users to check,

Comments
Sign in to join the conversation.
No comments yet. Be the first.