Parent

Included Modules

UbiquoJobs::Jobs::ActiveJob

Attributes

options[RW]

(Not documented)

Public Class Methods

filtered_search(filters = {}, options = {}) click to toggle source

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

Public Instance Methods

error_log() click to toggle source

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
output_log() click to toggle source

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
reset!() click to toggle source

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
set_property(property, value) click to toggle source

Save updated attributes. Optimistic locking is handled automatically by Active Record

    # File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 32
32:       def set_property(property, value)
33:         update_attribute property, value
34:       end

Protected Instance Methods

after_find() click to toggle source

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
notify_finished() click to toggle source

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_default_state() click to toggle source

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
store_options() click to toggle source

Store the options hash in the stored_options field, in yaml format

     # File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 100
100:       def store_options
101:         write_attribute :stored_options, self.options.to_yaml
102:       end
validate_command() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_jobs/lib/ubiquo_jobs/jobs/active_job.rb, line 94
94:       def validate_command
95:         errors.add_on_blank(:command)
96:         false unless errors.empty?
97:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.