Created
April 9, 2012 14:56
-
-
Save Amokrane/2344045 to your computer and use it in GitHub Desktop.
Task launcher
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
def perform | |
begin | |
code = IronWorkerNG::Code::Ruby.new | |
code.merge_worker File.dirname(__FILE__) + '/c2dm_iron_worker.rb' | |
code.merge_dir '../config' | |
code.merge_gem 'activerecord' | |
# Initialize the client | |
client = IronWorkerNG::Client.new(:token => 'xxx', :project_id => 'xxx') | |
# Upload the code | |
client.codes.create(code) | |
10.times do |i| | |
puts "IronWorker::Queueing worker for #{i}" | |
log = client.tasks.create('C2dmIronWorker', {}) | |
puts log | |
end | |
rescue => e | |
STDERR.puts "IronWorker::Error #{e}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment