Created
December 11, 2012 03:57
-
-
Save smostovoy/4255780 to your computer and use it in GitHub Desktop.
script for direct puting job into queue(sidekiq) w/o loading rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
begin | |
require 'sidekiq' | |
require 'honeybadger' | |
require File.expand_path(File.dirname(__FILE__)+"/../app/workers/base_worker") | |
Dir[File.dirname(__FILE__)+"/../app/workers/**/**"].each {|file| require File.expand_path(File.dirname(__FILE__)+file) } | |
worker = ARGV[0] | |
arg = ARGV[1] | |
if arg | |
p Object.const_get(worker).perform_async(arg) | |
else | |
p Object.const_get(worker).perform_async() | |
end | |
rescue =>e | |
Honeybadger.configure do |config| | |
config.api_key = 'some key' | |
config.environment_name = ENV["RAILS_ENV"] | |
config.ignore_only = [] | |
end | |
Honeybadger.notify_or_ignore(e, { | |
:component => 'queue.rb', | |
:parameters => {args: ARGV} | |
}) | |
p e.message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment