A simple job scheduler backed by Postgres.

Related tags

scheduler
Overview

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.

Owner
Morgan Gallant
Morgan Gallant
Job worker service that provides an API to run arbitrary Linux processes.

Job Scheduler Summary Prototype job worker service that provides an API to run arbitrary Linux processes. Overview Library The library (Worker) is a r

Renato Guimarães 5 Jun 2, 2021
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

Aliyun (Alibaba Cloud) Container Service 733 Jul 23, 2021
A simple job scheduler backed by Postgres.

A simple job scheduler backed by Postgres used in production at https://operand.ai. Setup needs two environment variables, SECRET and ENDPOINT. The se

Morgan Gallant 6 May 31, 2021
Job scheduling made easy.

scheduler Job scheduling made easy. Scheduler allows you to schedule recurrent jobs with an easy-to-read syntax. Inspired by the article Rethinking Cr

Carles Cerezo Guzmán 368 Jul 10, 2021
A persistent and flexible background jobs library for go.

Jobs Development Status Jobs is no longer being actively developed. I will still try my best to respond to issues and pull requests, but in general yo

Alex Browne 482 May 31, 2021
Efficient and reliable background processing for Go

CurlyQ CurlyQ provides a simple, easy-to-use interface for performing background processing in Go. It supports scheduled jobs, job deduplication, and

James McMath 112 Apr 25, 2021
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

Benjamin Cane 48 Jul 9, 2021
Simple, zero-dependency scheduling library for Go

go-quartz Simple, zero-dependency scheduling library for Go. About Inspired by the Quartz Java scheduler. Library building blocks Job interface. Any t

Eugene R. 145 Jul 10, 2021
A lightweight job scheduler based on priority queue with timeout, retry, replica, context cancellation and easy semantics for job chaining. Build for golang web apps.

Table of Contents Introduction What is RIO? Concern An asynchronous job processor Easy management of these goroutines and chaining them Introduction W

Supratim Samanta 36 Jul 7, 2021
Easy and fluent Go cron scheduling

goCron: A Golang Job Scheduling Package. goCron is a Golang job scheduling package which lets you run Go functions periodically at pre-determined inte

Go Co Op 952 Jul 22, 2021
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

Procyon 104 Jul 20, 2021
goCron: A Golang Job Scheduling Package.

goCron: A Golang Job Scheduling Package.

辣椒面 2.6k Jul 22, 2021
You had one job, or more then one, which can be done in steps

Leprechaun Leprechaun is tool where you can schedule your recurring tasks to be performed over and over. In Leprechaun tasks are recipes, lets observe

Strahinja 83 Jul 10, 2021
gron, Cron Jobs in Go.

gron Gron provides a clear syntax for writing and deploying cron jobs. Goals Minimalist APIs for scheduling jobs. Thread safety. Customizable Job Type

roylee0704 863 Jul 20, 2021