Class: Seijaku::SchedulerExecutor
- Inherits:
-
Object
- Object
- Seijaku::SchedulerExecutor
- Defined in:
- lib/seijaku/scheduler_executor.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(payload_obj, scheduler_spec, logger) ⇒ SchedulerExecutor
constructor
A new instance of SchedulerExecutor.
Constructor Details
#initialize(payload_obj, scheduler_spec, logger) ⇒ SchedulerExecutor
Returns a new instance of SchedulerExecutor.
6 7 8 9 10 11 12 13 14 |
# File 'lib/seijaku/scheduler_executor.rb', line 6 def initialize(payload_obj, scheduler_spec, logger) @name = scheduler_spec.fetch("name", nil) @every = scheduler_spec.fetch("every", nil) @payload_file = scheduler_spec.fetch("payload") @logger = logger @payload = payload_obj @status = :awaiting end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/seijaku/scheduler_executor.rb', line 3 def name @name end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/seijaku/scheduler_executor.rb', line 4 def status @status end |
Instance Method Details
#execute! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/seijaku/scheduler_executor.rb', line 16 def execute! while @status != :exiting do @logger.info "[SCHEDULER] <<- starting execution: #{@name}" @status = :started @payload.execute! @status = :awaiting @logger.info "[SCHEDULER] <<- finished execution: #{@name} (#{@every}s)" sleep @every end @status = :exited end |