Class: Capricorn::Apps::Jobs

Inherits:
Thor
  • Object
show all
Defined in:
lib/capricorn/apps/jobs.rb

Instance Method Summary collapse

Methods inherited from Thor

namespace, namespace=

Instance Method Details

#cancel(id) ⇒ Object



23
24
25
# File 'lib/capricorn/apps/jobs.rb', line 23

def cancel(id)
  Capricorn.client(options[: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(options[:token]).immediate_job(id.to_i)
end

#listObject



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(options[: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