All Projects → bibendi → schked

bibendi / schked

Licence: MIT license
Framework agnostic scheduler to run recurring jobs.

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to schked

jquery-schedule
jQuery Schedule
Stars: ✭ 53 (-32.05%)
Mutual labels:  schedule, scheduler
Advanced-xv6
Modern improvements for MIT's xv6 OS
Stars: ✭ 26 (-66.67%)
Mutual labels:  schedule, scheduler
nodejs-cron-job-must-know
it is an example of running node.js script with every certain period(cron job)
Stars: ✭ 35 (-55.13%)
Mutual labels:  schedule, scheduler
angular-gantt-schedule-timeline-calendar-example
Angular gantt-schedule-timeline-calendar usage example
Stars: ✭ 15 (-80.77%)
Mutual labels:  schedule, scheduler
Smart Scheduler Android
A utility library for scheduling periodic and non-periodic jobs efficiently.
Stars: ✭ 930 (+1092.31%)
Mutual labels:  schedule, scheduler
coo
Schedule Twitter updates with easy
Stars: ✭ 44 (-43.59%)
Mutual labels:  schedule, scheduler
linda
Linda is a simple dispatcher library.
Stars: ✭ 12 (-84.62%)
Mutual labels:  schedule, scheduler
croner
Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.
Stars: ✭ 169 (+116.67%)
Mutual labels:  schedule, scheduler
Crono
A time-based background job scheduler daemon (just like Cron) for Rails
Stars: ✭ 637 (+716.67%)
Mutual labels:  schedule, scheduler
Gocron
Easy and fluent Go cron scheduling. This is a fork from https://github.com/jasonlvhit/gocron
Stars: ✭ 605 (+675.64%)
Mutual labels:  schedule, scheduler
ld-scheduler
Schedule Launch Darkly flags on or off
Stars: ✭ 14 (-82.05%)
Mutual labels:  schedule, scheduler
Workq
Job server in Go
Stars: ✭ 1,546 (+1882.05%)
Mutual labels:  schedule, scheduler
OPoster
Scheduling Platform for Social Media Networks. Powered by Orienteer
Stars: ✭ 31 (-60.26%)
Mutual labels:  schedule, scheduler
krolib
Magic library and DSL to handle complex schedules
Stars: ✭ 19 (-75.64%)
Mutual labels:  schedule, scheduler
react-gantt-schedule-timeline-calendar
React Gantt Schedule Timeline Calendar component wrapper for gantt-schedule-timeline-calendar [ react gantt, gantt, react gantt chart, react schedule, react timeline, react calendar, gantt, schedule, scheduler, timeline, calendar, react gantt chart ]
Stars: ✭ 47 (-39.74%)
Mutual labels:  schedule, scheduler
scheduler
Task Scheduler for Laravel applications. UI from scratch
Stars: ✭ 18 (-76.92%)
Mutual labels:  schedule, scheduler
Xxl Job
A distributed task scheduling framework.(分布式任务调度平台XXL-JOB)
Stars: ✭ 20,197 (+25793.59%)
Mutual labels:  schedule, scheduler
Gantt Schedule Timeline Calendar
Gantt Gantt Gantt Timeline Schedule Calendar [ javascript gantt, js gantt, projects gantt, timeline, scheduler, gantt timeline, reservation timeline, react gantt, angular gantt, vue gantt, svelte gantt, booking manager ]
Stars: ✭ 990 (+1169.23%)
Mutual labels:  schedule, scheduler
Scheduler Card
HA Lovelace card for control of scheduler entities
Stars: ✭ 154 (+97.44%)
Mutual labels:  schedule, scheduler
Unimidi
Realtime MIDI IO for Ruby
Stars: ✭ 229 (+193.59%)
Mutual labels:  gem

Gem Version Build Status

Schked

Framework agnostic Rufus-scheduler wrapper to run recurring jobs.

Sponsored by Evil Martians

Installation

Add this line to your application's Gemfile:

gem "schked"

And then execute:

bundle

Or install it yourself as:

gem install schked

Usage

Ruby on Rails

.schked

--require config/environment.rb

config/schedule.rb

cron "*/30 * * * *", as: "CleanOrphanAttachmentsJob", timeout: "60s", overlap: false do
  CleanOrphanAttachmentsJob.perform_later
end

If you have a Rails engine with own schedule:

engine-path/lib/foo/engine.rb

module Foo
  class Engine < ::Rails::Engine
    initializer "foo" do |app|
      Schked.config.paths << root.join("config", "schedule.rb")
    end
  end
end

And run Schked:

bundle exec schked start

To show schedule:

bundle exec schked show

Duplicate scheduling

When you deploy your schedule to production, you want to start new instance before you shut down the current. And you don't want simultaneous working of both. To achieve a seamless transition, Schked is using Redis for locks.

You can configure Redis client as the following:

Schked.config.redis_servers = ["redis://127.0.0.1:7777", "redis://127.0.0.1:7778", "redis://127.0.0.1:7779"]

Callbacks

Also, you can define callbacks for errors handling:

config/initializers/schked.rb

Schked.config.register_callback(:on_error) do |job, error|
  Raven.capture_exception(error) if defined?(Raven)
end

There are :before_start and :after_finish callbacks as well.

Logging

By default Schked writes logs into stdout. In Rails environment Schked is using application logger. You can change it like this:

config/initializers/schked.rb

Schked.config.logger = Logger.new(Rails.root.join("log", "schked.log"))

Monitoring

Yabeda::Schked - built-in metrics for monitoring Schked recurring jobs out of the box! Part of the yabeda suite.

Testing

describe Schked do
  let(:worker) { described_class.worker.tap(&:pause) }

  around do |ex|
    Time.use_zone("UTC") { Timecop.travel(start_time, &ex) }
  end

  describe "CleanOrphanAttachmentsJob" do
    let(:start_time) { Time.zone.local(2008, 9, 1, 10, 42, 21) }
    let(:job) { worker.job("CleanOrphanAttachmentsJob") }

    specify do
      expect(job.next_time.to_local_time)
        .to eq Time.zone.local(2008, 9, 1, 11, 0, 0)
    end

    it "enqueues job" do
      expect { job.call(false) }
        .to have_enqueued_job(CleanOrphanAttachmentsJob)
    end
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bibendi/schked. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Schked project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].