Giter VIP home page Giter VIP logo

superarch's Introduction

SuperArch -- Scheduler

Scheduler of the Async Rest API

OverAll

Run!

Now let me tell you how to run the SuperArch

Setup the DB tables

Setup the DB SQL

Prepare the Data Middleware

/bin/bash setup/others.sh

P.S. You need docker installed

Build it

go mod tidy
cd cmd && go build main.go

Run the bin

./main

How to Add a new Task Module

  1. Write the core code in core/
  2. Register it in middleware/register/register.go

So easy!

Function

Register

  • Register the task modules
  • Send Task to the Task MQ
  • Get current MQ size

TaskControl

  • Init/Get/Update the Task status
  • Calc suggested retry=-for time and get the current Task waiting size
  • Init/Get/Update the Task type (task cost time, etc.)
  • Get result from DB when task finished

Process (Cron)

  • Sync the Task type(cost time) to DB
  • Clear the timeout Task

Design Ideas

SuperArch -- Scheduler

  • Use RabbitMQ to make different Module of Tasks different task queues
  • Use Reflect method to handle the Modules in single logic
  • Task Status Control & Waiting List Size
  • Set the interval time for obtaining task results intelligently and dynamically

SuperArchWorker -- Worker

  • AllinOne: A SuperArchWorker contains all the Modules, but only do one module of task which assigned to it
  • High concurrency: Each SuperArchWorker can do many tasks with n goroutines
  • Flexable: You can deploy many SuperArchWorkers, even use k8s
  • Compatibility: A SuperArchWorker can do with all kinds of services, like python,docker or other complex services

ToDo

  • Fix bugs
  • Draw the framework of each middleware

Demo

Demo Request

superarch's People

Contributors

xuxiaoxia96 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.