Class: BmcDaemonLib::WorkerBase
- Inherits:
-
Object
- Object
- BmcDaemonLib::WorkerBase
- Includes:
- LoggerHelper
- Defined in:
- lib/bmc-daemon-lib/worker_base.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Class options.
-
#pool ⇒ Object
readonly
Returns the value of attribute pool.
-
#wid ⇒ Object
readonly
Returns the value of attribute wid.
Instance Method Summary collapse
-
#initialize(wid, pool = nil) ⇒ WorkerBase
constructor
A new instance of WorkerBase.
Constructor Details
#initialize(wid, pool = nil) ⇒ WorkerBase
Returns a new instance of WorkerBase.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bmc-daemon-lib/worker_base.rb', line 10 def initialize wid, pool = nil # Logger @logger = LoggerPool.instance.get :workers @log_worker_status_changes = true # Configuration @config = {} # Set thread context Thread.current.thread_variable_set :pool, (@pool = pool) Thread.current.thread_variable_set :wid, (@wid = wid) Thread.current.thread_variable_set :started_at, Time.now worker_status WORKER_STATUS_STARTING # Ask worker to init itself, and return if there are errors if worker_init_result = worker_init log_error "worker_init aborting: #{worker_init_result.inspect}", @config else # We're ok, let's start out loop start_loop end end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Class options
6 7 8 |
# File 'lib/bmc-daemon-lib/worker_base.rb', line 6 def logger @logger end |
#pool ⇒ Object (readonly)
Returns the value of attribute pool.
7 8 9 |
# File 'lib/bmc-daemon-lib/worker_base.rb', line 7 def pool @pool end |
#wid ⇒ Object (readonly)
Returns the value of attribute wid.
8 9 10 |
# File 'lib/bmc-daemon-lib/worker_base.rb', line 8 def wid @wid end |