class Postjob::Job
A job
Constants
- STATUSES
Attributes
args[R]
created_at[R]
error[R]
error_backtrace[R]
error_message[R]
failed_attempts[R]
full_id[R]
id[R]
is_sticky[R]
last_worker_session_id[R]
max_attempts[R]
next_run_at[R]
parent_id[R]
queue[R]
recipients[R]
results[R]
root_id[R]
status[R]
sticky_host_id[R]
timed_out[R]
timing_out_at[R]
workflow[R]
workflow_method[R]
workflow_version[R]
Public Class Methods
find(job_id)
click to toggle source
# File lib/postjob/job.rb, line 7 def self.find(job_id) scope = Postjob::Queue.search("postjobs", id: job_id) Simple::SQL.ask(scope, into: Postjob::Job) end
Public Instance Methods
resolve()
click to toggle source
# File lib/postjob/job.rb, line 40 def resolve expect! status => STATUSES case status when "ok" then result when "ready" then :pending when "processing" then :pending when "sleep" then :pending when "timeout" then raise Timeout::Error when "err" then :pending when "failed" then raise Postjob::Error::Nonrecoverable, self end end
resolved?()
click to toggle source
# File lib/postjob/job.rb, line 54 def resolved? expect! status => STATUSES %w(ok timeout failed).include?(status) end
result()
click to toggle source
# File lib/postjob/job.rb, line 59 def result results && results.first end
to_s()
click to toggle source
# File lib/postjob/job.rb, line 63 def to_s full_workflow = workflow full_workflow += "@#{workflow_version}" if workflow_version != "" full_workflow += ".#{workflow_method}" if workflow_method != "run" args = (self.args || []).map(&:inspect).join(", ") "Postjob##{full_id}: #{full_workflow}(#{args}) (#{status})" end