Class: OpenWFE::Extras::DbErrorJournal
- Inherits:
-
OpenWFE::ErrorJournal
- Object
- OpenWFE::ErrorJournal
- OpenWFE::Extras::DbErrorJournal
- Includes:
- FeiMixin
- Defined in:
- lib/openwfe/extras/expool/dberrorjournal.rb
Overview
A database backed error journal.
(no synchronization needed it seems)
Instance Method Summary collapse
-
#get_error_log(wfid) ⇒ Object
Returns the error log for a given workflow/process instance, the older error first.
-
#get_error_logs ⇒ Object
Returns a map wfid => error log, ie returns 1 error log for each workflow/process instance that encountered an error.
-
#initialize(service_name, application_context) ⇒ DbErrorJournal
constructor
A new instance of DbErrorJournal.
-
#remove_error_log(wfid) ⇒ Object
Erases all the errors for one given workflow/process instance.
-
#remove_errors(wfid, errors) ⇒ Object
Removes a set of errors.
Constructor Details
#initialize(service_name, application_context) ⇒ DbErrorJournal
Returns a new instance of DbErrorJournal.
109 110 111 112 113 114 115 116 117 |
# File 'lib/openwfe/extras/expool/dberrorjournal.rb', line 109 def initialize (service_name, application_context) require 'openwfe/storage/yamlcustom' # making sure this file has been required at this point # this yamlcustom thing prevents the whole OpenWFE ecosystem # to get serialized :) super end |
Instance Method Details
#get_error_log(wfid) ⇒ Object
Returns the error log for a given workflow/process instance, the older error first.
123 124 125 126 127 128 |
# File 'lib/openwfe/extras/expool/dberrorjournal.rb', line 123 def get_error_log (wfid) wfid = extract_wfid wfid, true errors = ProcessError.find_all_by_wfid wfid, :order => "id asc" errors.collect { |e| e.owfe_error } end |
#get_error_logs ⇒ Object
Returns a map wfid => error log, ie returns 1 error log for each workflow/process instance that encountered an error.
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/openwfe/extras/expool/dberrorjournal.rb', line 142 def get_error_logs errors = ProcessError.find :all result = {} errors.each do |e| (result[e.wfid] ||= []) << e.owfe_error end result end |
#remove_error_log(wfid) ⇒ Object
Erases all the errors for one given workflow/process instance.
133 134 135 136 |
# File 'lib/openwfe/extras/expool/dberrorjournal.rb', line 133 def remove_error_log (wfid) ProcessError.destroy_all ["wfid = ?", wfid] end |
#remove_errors(wfid, errors) ⇒ Object
Removes a set of errors. This is used by the expool when resuming a previously broken process instance.
159 160 161 162 163 164 165 166 |
# File 'lib/openwfe/extras/expool/dberrorjournal.rb', line 159 def remove_errors (wfid, errors) errors = Array(errors) errors.each do |e| ProcessError.delete e.db_id end end |