Class: Ocular::Inputs::Cron::Input
- Defined in:
- lib/ocular/inputs/cron_input.rb
Defined Under Namespace
Classes: DSLProxy
Instance Attribute Summary collapse
-
#cron_enabled ⇒ Object
readonly
Returns the value of attribute cron_enabled.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
-
#scheduler ⇒ Object
readonly
Returns the value of attribute scheduler.
Instance Method Summary collapse
- #disable ⇒ Object
- #enable ⇒ Object
-
#initialize(settings_factory) ⇒ Input
constructor
A new instance of Input.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(settings_factory) ⇒ Input
Returns a new instance of Input.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ocular/inputs/cron_input.rb', line 31 def initialize(settings_factory) settings = settings_factory[:cron] @cron_enabled = true if settings[:lock] @cron_enabled = false end @scheduler = ::Rufus::Scheduler.new ::Ocular.logger.debug "Starting Rufus cron scheduler" if settings[:lock] @scheduler.every(settings[:lock_delay] || "10s", :overlap => false) do etcd = ::Ocular::DSL::Etcd.etcd() ret = etcd.get(settings[:lock]) pp ret end end end |
Instance Attribute Details
#cron_enabled ⇒ Object (readonly)
Returns the value of attribute cron_enabled.
29 30 31 |
# File 'lib/ocular/inputs/cron_input.rb', line 29 def cron_enabled @cron_enabled end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
27 28 29 |
# File 'lib/ocular/inputs/cron_input.rb', line 27 def routes @routes end |
#scheduler ⇒ Object (readonly)
Returns the value of attribute scheduler.
28 29 30 |
# File 'lib/ocular/inputs/cron_input.rb', line 28 def scheduler @scheduler end |
Instance Method Details
#disable ⇒ Object
60 61 62 |
# File 'lib/ocular/inputs/cron_input.rb', line 60 def disable() @cron_enabled = false end |
#enable ⇒ Object
64 65 66 |
# File 'lib/ocular/inputs/cron_input.rb', line 64 def enable() @cron_enabled = true end |
#start ⇒ Object
52 53 54 |
# File 'lib/ocular/inputs/cron_input.rb', line 52 def start() end |
#stop ⇒ Object
56 57 58 |
# File 'lib/ocular/inputs/cron_input.rb', line 56 def stop() @scheduler.shutdown end |