Skip to content

pioardi/hurricane-scheduler

Repository files navigation

hurricane-scheduler

Gitter chat
Task scheduler with high availability.

Contents

Overview
Features
REST API
Configuration

Overview

Hurricane scheduler is a distributed and fault-tolerant built on top of https://github.com/pioardi/ring-election .
It is able to schedule jobs that will execute your custom code writenn in node.js .

Features

Simple to install and to configure
Web UI (TODO)
REST API to create schedules
Limit your schedules based timezone and on hours,minutes,years,day of the week,month of the year, etc..
REST API monitoring API
REST API to create timers and be notified when time is up (TODO)
LDAP integrated (TODO)
Multiple data storage ( Cassandra, MongoDB , SQL databases , in-memory for development) TODO
Fully scalable , distributed and fault-tolerant, no zookeeper or other systems are needed ( based on leader/follower algorithm implemented in https://github.com/pioardi/ring-election )
Job stats ( failure/success , duration time , failure rate ) TODO
Configurable retries for each job
Job timeout
Alerting for failure jobs

REST API

Schedule API run on port JOB_PORT , see configuration section for details.
Schedule

Field name Field Type Mandatory Constraints Description
title String N No constraints The title of the job
timezone String Y A valid timezone , see all available timezones The timezone to refer to run job in the correct time , ex. I want to run a job at 8AM in Naples, is different from 8AM in Chicago
scriptId String Y A valid scriptId previously created The admin will create scripts to be executed when the job will run , each of this script will have an id to be used into the REST API
retries Number N N The number of retries that we want to do when a job fails. Default is 0
timeout Number N N The maximum time in seconds that we want to keep the job running , default is 60 seconds.
hours Array of Strings N Each value must be from 0 to 23 The hours in which we want our job to run, if not specified the job will run at all hours
minutes Array of Strings N Each value must be from 0 to 59 The minutes in which we want our job to run, if not specified the job will run at all minutes
weekDays Array of Strings N Each value must be from 0 to 6 The days of the week in which we want our job to run, if not specified the job will run all days of the week
daysOfTheMonth Array of Strings N Each value must be from 0 to 30 The days of the month in which we want our job to run, if not specified the job will run all days of the months
monthsOfTheYear Array of Strings N Each value must be from 0 to 11 The months of the year in which we want our job to run, if not specified the job will run all months of the years
years Array of Strings N No constraints The years in which we want our job to run, if not specified the job will run all years

Create schedules
HTTP VERB: POST
Path : /schedules
Input : Schedule

Output

Field name Field Type Description
id String The id of the created schedule

Delete schedules
HTTP VERB: DELETE
Path : /schedules/SCHEDULE_ID

Get schedules
HTTP VERB: GET
Path : /schedules/SCHEDULE_ID
Output: Schedule

Monitoring API run on MONITORING_PORT see configuration for details Get status
HTTP VERB: GET
Path : /status
Output: An array where each element represents a node into the cluster with assigned partitions , id and priority.

CONFIGURATION

Name Default Description
PORT 3000 The leader will start to listen on this port
TIME_TO_RECONNECT 3000 The time in ms to wait for a follower when he has to connect to a new leader in ms
MAX_INACTIVE_TIME 10000 The time in ms to wait for an heart beath from a node before to remove it.
HEARTH_BEAT_FREQUENCY 1000 The frequency in ms with which a hearth beat is performed by a follower
HEARTH_BEAT_CHECK_FREQUENCY 3000 The frequency in ms with which an hearth check is performed by a leader
LOG_LEVEL info Follow this https://www.npmjs.com/package/winston#logging-levels
NUM_PARTITIONS 10 Number of partitions to distribute across the cluster
SEED_NODES No default hostnames and ports of leader node comma separated, Ex . hostname1:port,hostname2:port
MONITORING_PORT 9000 port to expose rest service for monitoring
JOB_PORT 3000 port to expose rest service for schedules
LOG_FILE_ENGINE Default to root folder and name engine.log File name used to log engine.
SMTP_HOST No default SMTP Host to sent emails.
SMTP_PORT No default SMTP Port to sent emails.
SMTP_USER No default SMTP to basic auth on smtp server.
SMTP_PWD No default SMTP password for basic auth on smtp server.
EMAIL_ALERTING_ENABLED False If job alerting should be active or not.
EMAIL_LIST No default Comma separated emails to sent alerts.