Class: Que::Web::Viewmodels::Job

Inherits:
Struct
  • Object
show all
Defined in:
lib/que/web/viewmodels/job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ Job

Returns a new instance of Job.



7
8
9
10
11
# File 'lib/que/web/viewmodels/job.rb', line 7

def initialize(job)
  members.each do |m|
    self[m] = job[m]
  end
end

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def args
  @args
end

#backend_pidObject

Returns the value of attribute backend_pid

Returns:

  • (Object)

    the current value of backend_pid



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def backend_pid
  @backend_pid
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def data
  @data
end

#error_countObject

Returns the value of attribute error_count

Returns:

  • (Object)

    the current value of error_count



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def error_count
  @error_count
end

#expired_atObject

Returns the value of attribute expired_at

Returns:

  • (Object)

    the current value of expired_at



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def expired_at
  @expired_at
end

#finished_atObject

Returns the value of attribute finished_at

Returns:

  • (Object)

    the current value of finished_at



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def finished_at
  @finished_at
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def id
  @id
end

#job_classObject

Returns the value of attribute job_class

Returns:

  • (Object)

    the current value of job_class



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def job_class
  @job_class
end

#last_error_backtraceObject

Returns the value of attribute last_error_backtrace

Returns:

  • (Object)

    the current value of last_error_backtrace



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def last_error_backtrace
  @last_error_backtrace
end

#last_error_messageObject

Returns the value of attribute last_error_message

Returns:

  • (Object)

    the current value of last_error_message



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def last_error_message
  @last_error_message
end

#priorityObject

Returns the value of attribute priority

Returns:

  • (Object)

    the current value of priority



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def priority
  @priority
end

#queueObject

Returns the value of attribute queue

Returns:

  • (Object)

    the current value of queue



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def queue
  @queue
end

#run_atObject

Returns the value of attribute run_at

Returns:

  • (Object)

    the current value of run_at



2
3
4
# File 'lib/que/web/viewmodels/job.rb', line 2

def run_at
  @run_at
end

Instance Method Details

#humanized_job_classObject



17
18
19
20
21
22
23
24
# File 'lib/que/web/viewmodels/job.rb', line 17

def humanized_job_class
  case job_class
  when "ActiveJob::QueueAdapters::QueAdapter::JobWrapper"
    args.first[:job_class]
  else
    job_class
  end
end

#past_due?(relative_to = Time.now) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/que/web/viewmodels/job.rb', line 13

def past_due?(relative_to = Time.now)
  run_at < relative_to
end