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.



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

def initialize(job)
  members.each do |m|
    self[m] = job[m.to_s]
  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

#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

#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

#job_idObject

Returns the value of attribute job_id

Returns:

  • (Object)

    the current value of job_id



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

def job_id
  @job_id
end

#last_errorObject

Returns the value of attribute last_error

Returns:

  • (Object)

    the current value of last_error



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

def last_error
  @last_error
end

#pg_backend_pidObject

Returns the value of attribute pg_backend_pid

Returns:

  • (Object)

    the current value of pg_backend_pid



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

def pg_backend_pid
  @pg_backend_pid
end

#pg_last_queryObject

Returns the value of attribute pg_last_query

Returns:

  • (Object)

    the current value of pg_last_query



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

def pg_last_query
  @pg_last_query
end

#pg_last_query_started_atObject

Returns the value of attribute pg_last_query_started_at

Returns:

  • (Object)

    the current value of pg_last_query_started_at



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

def pg_last_query_started_at
  @pg_last_query_started_at
end

#pg_stateObject

Returns the value of attribute pg_state

Returns:

  • (Object)

    the current value of pg_state



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

def pg_state
  @pg_state
end

#pg_state_changed_atObject

Returns the value of attribute pg_state_changed_at

Returns:

  • (Object)

    the current value of pg_state_changed_at



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

def pg_state_changed_at
  @pg_state_changed_at
end

#pg_transaction_started_atObject

Returns the value of attribute pg_transaction_started_at

Returns:

  • (Object)

    the current value of pg_transaction_started_at



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

def pg_transaction_started_at
  @pg_transaction_started_at
end

#pg_waiting_on_lockObject

Returns the value of attribute pg_waiting_on_lock

Returns:

  • (Object)

    the current value of pg_waiting_on_lock



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

def pg_waiting_on_lock
  @pg_waiting_on_lock
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

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

Returns:

  • (Boolean)


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

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