ActiveRecord::Base
Ubiquo finder method See vendor/plugins/ubiquo_core/lib/extensions/active_record.rb to see an example of usage.
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 48
48: def self.filtered_search(filters = {}, options = {})
49:
50: scopes = create_scopes(filters) do |filter, value|
51: case filter
52: when :text
53: {:conditions => ["upper(name) LIKE upper(?)", "%#{value}%"]}
54: when :date_start
55: {:conditions => ["created_at > ?", "#{value}"]}
56: when :date_end
57: {:conditions => ["created_at < ?", "#{value}"]}
58: when :state
59: {:conditions => ["state = ?", value]}
60: when :state_not
61: {:conditions => ["state != ?", value]}
62: end
63: end
64:
65: apply_find_scopes(scopes) do
66: find(:all, options)
67: end
68: end
Returns the error messages produced by the job execution, if any
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 42
42: def error_log
43: self.result_error
44: end
Returns the outputted results of the job execution, if any
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 37
37: def output_log
38: self.result_output
39: end
Set a job to be executed (again), giving it a planification time Useful e.g. for a stopped job or a job that has not had a succesful execution (is in error state) but you want a retry.
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 73
73: def reset!
74: update_attributes(
75: :runner => nil,
76: :state => STATES[:waiting],
77: :planified_at => Time.now.utc + Base.retry_interval
78: )
79: end
Load the stored options (which are stored in yaml) into the options hash
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 105
105: def after_find
106: self.options = YAML::load(self.stored_options.to_s)
107: end
Using the configured notifier, send a “finished job” email, if a receiver has been set in notify_to
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 90
90: def notify_finished
91: UbiquoJobs.notifier.deliver_finished_job self unless notify_to.blank?
92: end
Set the waiting state as default
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 84
84: def set_default_state
85: self.state ||= STATES[:waiting]
86: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.