Code Monkey home page Code Monkey logo

chronos-api's Introduction

chronos-api

Gem Version travis-ci

This gem provides a CLI and a simple REST API client for Chronos.

Installation

Add this line to your application's Gemfile:

gem 'chronos-api', :require => 'chronos'

And then run:

$ bundle install

Usage

Authentification

You have two options to set authentification if your Chronos API requires it:

Chronos.options = {:username => 'your-user-name', :password => 'your-secret-password'}

or

$ export CHRONOS_USER=your-user-name
$ export CHRONOS_PASSWORD=your-secret-password
$ irb
irb(main):001:0> require 'chronos'
=> true
irb(main):002:0> Chronos.options
=> {:username => "your-user-name", :password => "your-secret-password"}

or

$ chronos -c http://USERNAME:PASSWORD@HOST:PORT

List

To list the current scheduled jobs:

require 'chronos'
jobs = Chronos.list

or

$ chronos list

Add a job

To add a new job:

require 'chronos'
Chronos.add({
  name: 'myjob',
  schedule: 'R10/2012-10-01T05:52:00Z/PT2S',
  epsilon: 'PT15M',
  command: 'echo foobar',
  owner: '[email protected]',
  async: false
})

or

$ chronos add --job /path/to/job/details.json

Delete a job

To delete a job:

require 'chronos'
Chronos.delete('job_name')

or

$ chronos delete --name job_name

Delete all jobs

To delete all jobs:

require 'chronos'
Chronos.delete_all

or

$ chronos delete_all

Manually start a job

To manually start a job:

require 'chronos'
Chronos.start('job_name')

or

$ chronos start --name job_name

Contributing

Please fork and send pull request. Make sure to have test cases for your changes.

Credits

This gem has been highly inspired by marathon-api.

License

This program is licensed under the MIT license. See LICENSE for details.

chronos-api's People

Contributors

redox avatar

Watchers

 avatar  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.