Giter Site home page Giter Site logo

proby-ruby's Introduction

Proby

A simple library for working with the Proby task monitoring application.

Build Status

Installation

RubyGems

Proby can be installed using RubyGems

gem install proby

Inside your script, be sure to

require "rubygems"
require "proby"

Bundler

If you're using Bundler, add the following to your Gemfile

gem "proby"

and then run

bundle install

Setup

Before notifications can be sent, you must tell Proby your API key. This only needs to be done once, and should ideally be done inside your apps initialization code.

Proby.api_key = "b4fe1200c105012efde3482a1411a947"

In addition, you can optionally give Proby a logger to use.

Proby.logger = Rails.logger

Sending Notifications

The easiest way to have Proby monitor your task is by wrapping your code in a call to Proby's monitor function.

Proby.monitor(task_api_id) do
  # Do something here
end

You can also send the start and finish notifications manually via calls to send_start_notification and send_finish_notification.

Proby.send_start_notification(task_api_id)
# Do something here
Proby.send_finish_notification(task_api_id)

Specifying the task_api_id when calling any of the the notification methods is optional. If it is not provided, Proby will use the value of the PROBY_TASK_ID environment variable. If no task id is specified in the method call, and no value is set in the PROBY_TASK_ID environment variable, then no notification will be sent.

The Resque Plugin

The Resque plugin will automatically send start and finish notifications to Proby when your job starts and finishes. Simply extend Proby::ResquePlugin in your Resque job. The task id can either be pulled from the PROBY_TASK_ID environment variable, or specified in the job itself by setting the @proby_id attribute to the task id.

class SomeJob
  extend Proby::ResquePlugin
  @proby_id = 'abc123'  # Or simply let it use the value in the PROBY_TASK_ID environment variable

  self.perform
    do_stuff
  end
end

Managing Tasks

The Proby::ProbyTask class can be used to create, read, update, delete, pause, and unpause your tasks on Proby.

my_tasks = Proby::ProbyTask.find(:all)
a_specific_task = Proby::ProbyTask.find("the_proby_task_id")

task = Proby::ProbyTask.create(:name => 'Task name', :crontab => '* * * * *')

task.name = "New name"
task.save

task.pause
task.unpause

task.delete

API Doc

http://rdoc.info/github/signal/proby-ruby/master/frames

proby-ruby's People

Contributors

jwood avatar dipth avatar

Watchers

 avatar

Forkers

buttercloud

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.