Class: Capricorn::Apps::Jobs
Instance Method Summary collapse
Methods inherited from Thor
Instance Method Details
#cancel(id) ⇒ Object
23 24 25 |
# File 'lib/capricorn/apps/jobs.rb', line 23 def cancel(id) Capricorn.client([:token]).cancel_job(id.to_i) end |
#immediate(id) ⇒ Object
29 30 31 |
# File 'lib/capricorn/apps/jobs.rb', line 29 def immediate(id) Capricorn.client([:token]).immediate_job(id.to_i) end |
#list ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/capricorn/apps/jobs.rb', line 9 def list queued_jobs = Capricorn.client([:token]).queued_jobs queued_jobs.each do |id, name, canceled, immediated, running, waiting, delay| status = [] status.push canceled ? 'c' : ' ' status.push immediated ? 'i' : ' ' status.push running ? 'r' : ' ' status.push waiting ? 'w' : ' ' puts("% 8d % 8d % 8s %s" % [id, delay.to_i, status.join, name]) end end |