Class: Splash::Daemon::Orchestrator::Scheduler

Inherits:
Object
  • Object
show all
Includes:
Commands, Config, Constants, Grammar, Helpers, Loggers, Logs, Processes, Sequences, Transports
Defined in:
lib/splash/daemon/orchestrator.rb

Overview

Splash Scheduler object

Constant Summary

Constants included from Constants

Constants::AUTHOR, Constants::BACKENDS_STRUCT, Constants::CONFIG_FILE, Constants::COPYRIGHT, Constants::DAEMON_LOGMON_SCHEDULING, Constants::DAEMON_METRICS_SCHEDULING, Constants::DAEMON_PID_FILE, Constants::DAEMON_PROCESS_NAME, Constants::DAEMON_PROCMON_SCHEDULING, Constants::DAEMON_STDERR_TRACE, Constants::DAEMON_STDOUT_TRACE, Constants::DEFAULT_RETENTION, Constants::EMAIL, Constants::EXECUTION_TEMPLATE, Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Constants::LICENSE, Constants::LOGGERS_STRUCT, Constants::PID_PATH, Constants::PROMETHEUS_ALERTMANAGER_URL, Constants::PROMETHEUS_PUSHGATEWAY_URL, Constants::PROMETHEUS_URL, Constants::TRACE_PATH, Constants::TRANSPORTS_STRUCT, Constants::VERSION, Constants::WEBADMIN_IP, Constants::WEBADMIN_PID_FILE, Constants::WEBADMIN_PID_PATH, Constants::WEBADMIN_PORT, Constants::WEBADMIN_PROCESS_NAME, Constants::WEBADMIN_PROXY, Constants::WEBADMIN_STDERR_TRACE, Constants::WEBADMIN_STDOUT_TRACE

Constants included from Exiter

Exiter::EXIT_MAP

Constants included from Loggers

Loggers::ALIAS, Loggers::LEVELS

Constants included from Grammar

Grammar::VERBS

Instance Method Summary collapse

Methods included from Sequences

#list_seq, #run_seq, #schedule_seq, #show_seq

Methods included from Transports

#get_default_client, #get_default_subscriber

Methods included from Config

#get_config, #rehash_config

Methods included from ConfigUtilities

#addservice, #checkconfig, #flush_backend, #setupsplash

Methods included from Helpers

#check_unicode_term, #daemonize, #format_by_extensions, #format_response, #get_processes, #group_root, #install_file, #is_root?, #make_folder, #make_link, #run_as_root, #search_file_in_gem, #user_root, #verify_file, #verify_folder, #verify_link, #verify_service

Methods included from Exiter

#splash_exit, #splash_return

Methods included from Loggers

#change_logger, #get_logger, #get_session

Methods included from Grammar

#ack_command, #execute_command, #get_jobs, #list_commands, #ping, #reset, #shutdown

Constructor Details

#initialize(options = {}) ⇒ Scheduler

Constructor prepare the Scheduler commands Schedules logs monitorings process monitorings

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :scheduling (Symbol)

    activate commands scheduling



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/splash/daemon/orchestrator.rb', line 32

def initialize(options = {})
  @log = get_logger
  self.extend Splash::Daemon::Metrics
  @session = get_session
  @metric_manager = get_metrics_manager(@session)
  $stdout.sync = true
  $stderr.sync = true
  @server  = Rufus::Scheduler::new
  @server.extend SchedulerHooks
  @config = get_config
  @scheduling = options[:scheduling]

  @log.info "Splash Orchestrator starting :"
  if @scheduling then
    @log.item "Initializing Sequences & commands Scheduling."
    init_commands_scheduling
    init_sequences_scheduling
  end

  init_logs_monitoring_scheduling
  init_process_monitoring_scheduling
  init_metrics_scheduling
  init_daemon_subscriber

end

Instance Method Details

#terminatehash

Stop the Splash daemon gracefully

Returns:

  • (hash)

    Exiter Case :quiet_exit



64
65
66
67
68
69
# File 'lib/splash/daemon/orchestrator.rb', line 64

def terminate
  @log.info "Splash daemon shutdown"
  @server.shutdown
  change_logger logger: :cli
  splash_exit case: :quiet_exit
end