Class: Wurk::IterableJobQuery::State

Inherits:
Struct
  • Object
show all
Defined in:
lib/wurk/iterable_job_query.rb

Overview

One job’s iteration state. ‘raw` is the `it-<jid>` HASH (String=>String); the accessors decode the wire fields (`ex`/`rt`/`c`/`cancelled`, §1.5).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jidObject

Returns the value of attribute jid

Returns:

  • (Object)

    the current value of jid



19
20
21
# File 'lib/wurk/iterable_job_query.rb', line 19

def jid
  @jid
end

#rawObject

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



19
20
21
# File 'lib/wurk/iterable_job_query.rb', line 19

def raw
  @raw
end

Instance Method Details

#cancelledObject

Epoch-seconds timestamp the job was cancelled at, or nil if it wasn’t.



25
26
27
28
# File 'lib/wurk/iterable_job_query.rb', line 25

def cancelled
  ts = raw['cancelled']
  ts && !ts.to_s.empty? ? ts.to_i : nil
end

#cursorObject



22
# File 'lib/wurk/iterable_job_query.rb', line 22

def cursor     = raw['c'] && ::JSON.parse(raw['c'])

#executionsObject



20
# File 'lib/wurk/iterable_job_query.rb', line 20

def executions = raw['ex'].to_i

#runtimeObject



21
# File 'lib/wurk/iterable_job_query.rb', line 21

def runtime    = raw['rt'].to_f