A simple job scheduler backed by Postgres.

Deploy on Railway

A simple job scheduler backed by Postgres used in production at https://operand.ai. Setup needs two environment variables, SECRET and ENDPOINT. The secret is attached to incoming/outgoing requests within the Scheduler-Secret HTTP header, and is used both by the scheduler to verify that incoming request is legit, as well as the end-application to verify the request is coming from the scheduler. The endpoint is simply the URL to send HTTP requests to.

This scheduler also has support for CRON-type expressions. This allows the application to specify a set of id's to run on a schedule. You should probably just make a request on application start with all the IDs and the relevant CRON expressions. This will tear-down the world and re-start the CRON server with the new values. This is how you should do it, especially in auto-deployment environments. When a cron job fires, the application will get a POST with the "cron_id" set. You should check for this in the message and respond appropriately.

This is used in production at Operand.

Example Usage:

Scheduling a Job

POST https://scheduler.yourcompany.com/insert
Headers: Scheduler-Secret=XXXXXX

{
    "timestamp": "2021-04-15T14:17:00-07:00",
    "body": {
        "foo": "bar"
    }
}

Response:
{"id":"cknjdu2k300153zugmucamxxo"}

Cancelling a Scheduled Job (note: if the job doesn't exist, this will fail silently.)

POST https://scheduler.yourcompany.com/delete
Headers: Scheduler-Secret=XXXXXX

{
    "id":"cknjdu2k300153zugmucamxxo"
}

Response: None

Configuring CRON Jobs

POST https://scheduler.yourcompany.com/cron
Headers: Scheduler-Secret=XXXXXX

{
    "jobs":[
        {
            "id":"hello_world",
            "spec": "30 * * * * *"
        },
        {
            "id":"hello_world_2",
            "spec": "0 * * * * *"
        }
    ]
}

Response: None

When a scheduled job, or a CRON job fires, your application (located at endpoint) will get the following message in a POST:

{
  "id": "<job id>", // will be empty if cron_id non-empty
  "cron_id": "<cron id>", // will be empty if id non-empty
  "body": { // Omitted for CRON jobs.
    ... // Your stuff here
  }
}

And that's it! Feel free to file issues or do pull requests.

Similar Resources

clockwork - Simple and intuitive job scheduling library in Go.

clockwork - Simple and intuitive job scheduling library in Go.

clockwork A simple and intuitive scheduling library in Go. Inspired by python's schedule and ruby's clockwork libraries. Example use package main imp

Jul 27, 2022

Tasqueue is a simple, lightweight distributed job/worker implementation in Go

Tasqueue Tasqueue is a simple, lightweight distributed job/worker implementation in Go Concepts tasqueue.Broker is a generic interface that provides m

Dec 24, 2022

GPU Sharing Scheduler for Kubernetes Cluster

GPU Sharing Scheduler for Kubernetes Cluster

GPU Sharing Scheduler Extender in Kubernetes Overview More and more data scientists run their Nvidia GPU based inference tasks on Kubernetes. Some of

Jan 6, 2023

Package tasks is an easy to use in-process scheduler for recurring tasks in Go

Tasks Package tasks is an easy to use in-process scheduler for recurring tasks in Go. Tasks is focused on high frequency tasks that run quick, and oft

Dec 18, 2022

Chrono is a scheduler library that lets you run your task and code periodically

Chrono is a scheduler library that lets you run your task and code periodically

Chrono is a scheduler library that lets you run your tasks and code periodically. It provides different scheduling functionalities to make it easier t

Dec 26, 2022

cpuworker - A Customized Goroutine Scheduler over Golang Runtime

cpuworker - A Customized Goroutine Scheduler over Golang Runtime

cpuworker Status Working in process. Run the Demo Make sure the GOMAXPROCS is bigger than 1 and there is at least GOMAXPROCS physical OS threads avail

Dec 6, 2022

Chadburn is a scheduler alternative to cron, built on Go and designed for Docker environments.

Chadburn - a job scheduler Chadburn is a modern and low footprint job scheduler for docker environments, written in Go. Chadburn aims to be a replacem

Dec 6, 2022

A Framework for FaaS load balancing | stack-scheduler repository|

P2PFaaS A Framework for FaaS load balancing | stack-scheduler repository Introduction The P2PFaaS is a framework that allows you to implement a load b

Oct 29, 2021

Go distributed task scheduler

Go distributed task scheduler

Nov 13, 2021
Simple job queues for Go backed by Redis
Simple job queues for Go backed by Redis

bokchoy Introduction Bokchoy is a simple Go library for queueing tasks and processing them in the background with workers. It should be integrated in

Dec 13, 2022
nano-gpu-scheduler is a Kubernetes scheduler extender for GPU resources scheduling.
nano-gpu-scheduler is a Kubernetes scheduler extender for GPU resources scheduling.

Nano GPU Scheduler About This Project With the continuous evolution of cloud native AI scenarios, more and more users run AI tasks on Kubernetes, whic

Dec 29, 2022
Statefulset-scheduler (aka sfs-scheduler)

statefulset-scheduler (aka sfs-scheduler) Installation I already upload docker i

Dec 19, 2021
Scheduler: the scheduler of distbuild written in Golang

scheduler Introduction scheduler is the scheduler of distbuild written in Go. Pr

Feb 9, 2022
Scheduler - Scheduler package is a zero-dependency scheduling library for Go

Scheduler Scheduler package is a zero-dependency scheduling library for Go Insta

Jan 14, 2022
Linstor-scheduler-extender - LINSTOR scheduler extender plugin for Kubernetes

linstor-scheduler-extender LINSTOR scheduler extender plugin for Kubernetes whic

Dec 30, 2022
Crane scheduler is a Kubernetes scheduler which can schedule pod based on actual node load.

Crane-scheduler Overview Crane-scheduler is a collection of scheduler plugins based on scheduler framework, including: Dynamic scheuler: a load-aware

Dec 29, 2022
goInterLock is golang job/task scheduler with distributed locking mechanism (by Using Redis🔒).
goInterLock is golang job/task scheduler with distributed locking mechanism (by Using Redis🔒).

goInterLock is golang job/task scheduler with distributed locking mechanism. In distributed system locking is preventing task been executed in every instant that has the scheduler,

Dec 5, 2022
Executes jobs in separate GO routines. Provides Timeout, StartTime controls. Provides Cancel all running job before new job is run.

jobExecutor Library to execute jobs in GO routines. Provides for Job Timeout/Deadline (MaxDuration()) Job Start WallClock control (When()) Add a job b

Jan 10, 2022
Simple, efficient background processing for Golang backed by RabbitMQ and Redis
Simple, efficient background processing for Golang backed by RabbitMQ and Redis

Table of Contents How to Use Motivation Requirements Features Examples Setup Config Client/Server Task Worker/Task Hander Register The Handlers Send t

Nov 10, 2022