Skip to content

Instantly share code, notes, and snippets.

@Amokrane
Created April 9, 2012 14:56
Show Gist options
  • Save Amokrane/2344045 to your computer and use it in GitHub Desktop.
Save Amokrane/2344045 to your computer and use it in GitHub Desktop.
Task launcher
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