Class: Lepus::Supervisor
- Inherits:
-
Processes::Base
- Object
- Processes::Base
- Lepus::Supervisor
- Includes:
- ChildrenPipes, LifecycleHooks, Maintenance, Pidfiled, RegistryCleaner, Signals
- Defined in:
- lib/lepus/supervisor.rb,
lib/lepus/supervisor/pidfile.rb,
lib/lepus/supervisor/signals.rb,
lib/lepus/supervisor/pidfiled.rb,
lib/lepus/supervisor/maintenance.rb,
lib/lepus/supervisor/children_pipes.rb,
lib/lepus/supervisor/lifecycle_hooks.rb,
lib/lepus/supervisor/registry_cleaner.rb
Defined Under Namespace
Modules: ChildrenPipes, LifecycleHooks, Maintenance, Pidfiled, RegistryCleaner, Signals Classes: Pidfile
Constant Summary collapse
- SHUTDOWN_MSG =
"shutdown"
Instance Attribute Summary
Attributes inherited from Processes::Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(require_file: nil, pidfile: "tmp/pids/lepus.pid", shutdown_timeout: 5, **kwargs) ⇒ Supervisor
constructor
A new instance of Supervisor.
- #start ⇒ Object
- #stop ⇒ Object
Methods included from RegistryCleaner
Methods included from Pidfiled
Methods included from Signals
Methods included from Maintenance
Methods included from ChildrenPipes
Methods included from LifecycleHooks
Methods inherited from Processes::Base
#hostname, #kind, #metadata, #pid
Methods included from Processes::Procline
Methods included from Processes::Interruptible
Methods included from Processes::Registrable
Methods included from AppExecutor
#handle_thread_error, #wrap_in_app_executor
Methods included from Processes::Callbacks
Constructor Details
#initialize(require_file: nil, pidfile: "tmp/pids/lepus.pid", shutdown_timeout: 5, **kwargs) ⇒ Supervisor
Returns a new instance of Supervisor.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lepus/supervisor.rb', line 24 def initialize(require_file: nil, pidfile: "tmp/pids/lepus.pid", shutdown_timeout: 5, **kwargs) @pidfile_path = pidfile @require_file = require_file @shutdown_timeout = shutdown_timeout.to_i @consumer_class_names = Array(kwargs[:consumers]).map(&:to_s) if kwargs.key?(:consumers) @forks = {} @pipes = {} @configured_processes = {} super @name ||= hostname end |
Class Method Details
.start(**options) ⇒ Object
15 16 17 |
# File 'lib/lepus/supervisor.rb', line 15 def start(**) new(**).tap(&:start) end |
Instance Method Details
#start ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lepus/supervisor.rb', line 39 def start boot run_start_hooks build_and_start_workers launch_maintenance_task supervise end |
#stop ⇒ Object
50 51 52 53 54 |
# File 'lib/lepus/supervisor.rb', line 50 def stop super run_stop_hooks end |