Class: Cyclid::Cli::AdminJob

Inherits:
Thor
  • Object
show all
Defined in:
lib/cyclid/cli/admin/job.rb

Overview

‘admin job’ sub-commands

Instance Method Summary collapse

Instance Method Details

#list(name) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cyclid/cli/admin/job.rb', line 22

def list(name)
  stats = client.job_stats(name)
  all = client.job_list(name, limit: stats['total'])
  jobs = all['records']

  jobs.each do |job|
    Formatter.colorize 'Name', (job['job_name'] || '')
    Formatter.colorize "\tJob", job['id'].to_s
    Formatter.colorize "\tVersion", (job['job_version'] || '')
  end
rescue StandardError => ex
  abort "Failed to get job list: #{ex}"
end

#stats(name) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/cyclid/cli/admin/job.rb', line 37

def stats(name)
  stats = client.job_stats(name)

  Formatter.colorize 'Total jobs', stats['total'].to_s
rescue StandardError => ex
  abort "Failed to get job list: #{ex}"
end