Skip to content

Instantly share code, notes, and snippets.

@crohr
Created March 31, 2010 14:13
Show Gist options
  • Save crohr/350359 to your computer and use it in GitHub Desktop.
Save crohr/350359 to your computer and use it in GitHub Desktop.
until jobs.empty? do
job = jobs.shift
if job.reload['state'] == 'running'
begin
job.parent.deployments.submit({
:nodes => job['assigned_nodes'],
:environment => 'lenny-x64-nfs_rc@granquet'
)
rescue Restfully::HTTP::ServerError => e
puts e.message
puts "Putting the job back on the queue to retry later"
jobs.push(job)
end
else
puts "Job not running. Putting back on the queue"
jobs.push(job)
sleep 2
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment