Class: Cyclid::API::Plugins::Notifier::Local
- Defined in:
- app/cyclid/plugins/dispatcher/local.rb
Overview
This is a local Notifier, so it can just pass updates directly on to the JobRecord & LogBuffer
Instance Method Summary collapse
-
#completion(success) ⇒ Object
Ping the callback completion hook, if required.
-
#ended=(time) ⇒ Object
Set the JobRecord ended.
-
#initialize(job_id, callback) ⇒ Local
constructor
A new instance of Local.
-
#status=(status) ⇒ Object
Set the JobRecord status.
-
#write(data) ⇒ Object
Write data to the log buffer.
Constructor Details
#initialize(job_id, callback) ⇒ Local
Returns a new instance of Local.
90 91 92 93 94 95 96 97 98 |
# File 'app/cyclid/plugins/dispatcher/local.rb', line 90 def initialize(job_id, callback) @job_id = job_id @job_record = JobRecord.find(job_id) # Create a LogBuffer @log_buffer = LogBuffer.new(@job_record) @callback = callback end |
Instance Method Details
#completion(success) ⇒ Object
Ping the callback completion hook, if required
116 117 118 |
# File 'app/cyclid/plugins/dispatcher/local.rb', line 116 def completion(success) @callback&.completion(@job_id, success) end |
#ended=(time) ⇒ Object
Set the JobRecord ended
110 111 112 113 |
# File 'app/cyclid/plugins/dispatcher/local.rb', line 110 def ended=(time) @job_record.ended = time @job_record.save! end |
#status=(status) ⇒ Object
Set the JobRecord status
101 102 103 104 105 106 107 |
# File 'app/cyclid/plugins/dispatcher/local.rb', line 101 def status=(status) @job_record.status = status @job_record.save! # Ping the callback status_changed hook, if required @callback&.status_changed(@job_id, status) end |
#write(data) ⇒ Object
Write data to the log buffer
121 122 123 124 125 126 |
# File 'app/cyclid/plugins/dispatcher/local.rb', line 121 def write(data) @log_buffer.write data # Ping the callback log_write hook, if required @callback&.log_write(@job_id, data) end |