Go distributed task scheduler

gosched

Go distributed task scheduler

Getting Started

Download

go get github.com/inuggets/gosched

Usage

Worker

import (
    sched "github.com/inuggets/gosched"
    "github.com/inuggets/nmq"
)

type Addend struct {
    A int64
    B int64
}

// New worker
w := sched.NewWorker(
    "test", // Worker name
    nmq.NewRedisPool("localhost:6379", ""), // redis pool
    &sched.WorkerOptions{ // options
        Processors: 2,
    },
)

// Register 'add' task
w.AddTask(&Task{
    ID:   "add",
    Func: func(payload string) error {
        // Run task
        addend := &Addend{}
        err := json.Unmarshal([]byte(payload), addend)
        if err != nil {
            return err
        }
        log.Default().Println(fmt.Sprintf("%d + %d = %d\n", addend.A, addend.B, addend.A+addend.B))
        return nil
    },
})

// Start worker
go w.Start()

Client

import (
    sched "github.com/inuggets/gosched"
    "github.com/inuggets/nmq"
)

client := sched.NewClient(nmq.NewRedisPool("localhost:6379", ""), "test")
addend := &Addend{
    A: 1,
    B: 2,
}
bytes, err := json.Marshal(addend)
if err != nil {
    log.Fatal(err)
}

// Submit 'add' task
err = client.SubmitTask("add", string(bytes))
if err != nil {
    log.Fatal(err)
}

License

gosched is under the MIT license. See the LICENSE for detail.

Owner
Nuggets
If it's a rose, it will bloom sooner or later
Nuggets
Similar Resources

Celery Distributed Task Queue in Go

Celery Distributed Task Queue in Go

gocelery Go Client/Server for Celery Distributed Task Queue Why? Having been involved in several projects migrating servers from Python to Go, I have

Jan 1, 2023

Machinery is an asynchronous task queue/job queue based on distributed message passing.

Machinery is an asynchronous task queue/job queue based on distributed message passing.

Machinery Machinery is an asynchronous task queue/job queue based on distributed message passing. V2 Experiment First Steps Configuration Lock Broker

Dec 24, 2022

high performance distributed task scheduling system, Support multi protocol scheduling tasks

 high performance distributed task scheduling system, Support multi protocol scheduling tasks

high performance distributed task scheduling system, Support multi protocol scheduling tasks

Dec 2, 2022

YTask is an asynchronous task queue for handling distributed jobs in golang

YTask is an asynchronous task queue for handling distributed jobs in golang

YTask is an asynchronous task queue for handling distributed jobs in golang

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

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

Dec 9, 2022

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

Sep 10, 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
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
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
Task Timer (tt) is a dead simple TUI task timer
Task Timer (tt) is a dead simple TUI task timer

tasktimer Task Timer (tt) is a dead simple TUI task timer Usage To get started, just run tt: tt You'll be presented with something like this: You can

Dec 21, 2022
Gotask - A simple task queue is stripped when the program is written to achieve the task delivery function
Gotask - A simple task queue is stripped when the program is written to achieve the task delivery function

gotask The simple task queue is stripped when the program is written to achieve

Feb 14, 2022
Distributed Task Scheduling System|分布式定时任务调度平台
Distributed Task Scheduling System|分布式定时任务调度平台

Crocodile Distributed Task Scheduling System English | 中文 Introduction A distributed task scheduling system based on Golang that supports http request

Jan 5, 2023