Class: Exekutor::Internal::CLI::Info

Inherits:
Object
  • Object
show all
Includes:
ApplicationLoader
Defined in:
lib/exekutor/internal/cli/info.rb

Overview

Prints info for the CLI

Constant Summary

Constants included from ApplicationLoader

ApplicationLoader::LOADING_MESSAGE

Instance Method Summary collapse

Methods included from ApplicationLoader

#clear_application_loading_message, #different_time_zone?, #load_application, #print_time_zone_warning

Constructor Details

#initialize(options) ⇒ Info

Returns a new instance of Info.



15
16
17
# File 'lib/exekutor/internal/cli/info.rb', line 15

def initialize(options)
  @global_options = options
end

Instance Method Details

Prints Exekutor info to STDOUT



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/exekutor/internal/cli/info.rb', line 20

def print(options)
  load_application(options[:environment], print_message: !quiet?)

  ActiveSupport.on_load(:active_record, yield: true) do
    clear_application_loading_message
    print_time_zone_warning if different_time_zone? && !quiet?

    hosts = Exekutor::Info::Worker.distinct.pluck(:hostname)
    job_info = pending_jobs_per_queue

    print_workers(hosts, job_info.present?, options)
    puts
    print_jobs(job_info)
  end
end