Class: CanvasSync::JobBatches::Batch::Status
- Inherits:
-
Object
- Object
- CanvasSync::JobBatches::Batch::Status
- Defined in:
- lib/canvas_sync/job_batches/status.rb
Instance Attribute Summary collapse
-
#bid ⇒ Object
readonly
Returns the value of attribute bid.
Instance Method Summary collapse
- #child_count ⇒ Object
- #complete? ⇒ Boolean
- #completed_children_count ⇒ Object
- #completed_count ⇒ Object
- #created_at ⇒ Object
- #data ⇒ Object
- #dead ⇒ Object
- #failed_children_count ⇒ Object
- #failure_info ⇒ Object
- #failures ⇒ Object
-
#initialize(bid) ⇒ Status
constructor
A new instance of Status.
- #job_count ⇒ Object
- #join ⇒ Object
- #parent_bid ⇒ Object
- #pending ⇒ Object
- #success? ⇒ Boolean
- #successful_children_count ⇒ Object
Constructor Details
Instance Attribute Details
#bid ⇒ Object (readonly)
Returns the value of attribute bid.
5 6 7 |
# File 'lib/canvas_sync/job_batches/status.rb', line 5 def bid @bid end |
Instance Method Details
#child_count ⇒ Object
56 57 58 |
# File 'lib/canvas_sync/job_batches/status.rb', line 56 def child_count Batch.redis { |r| r.hget("BID-#{bid}", 'children') }.to_i end |
#complete? ⇒ Boolean
48 49 50 |
# File 'lib/canvas_sync/job_batches/status.rb', line 48 def complete? 'true' == Batch.redis { |r| r.hget("BID-#{bid}", 'complete') } end |
#completed_children_count ⇒ Object
60 61 62 |
# File 'lib/canvas_sync/job_batches/status.rb', line 60 def completed_children_count Batch.redis { |r| r.scard("BID-#{bid}-batches-complete") }.to_i end |
#completed_count ⇒ Object
28 29 30 |
# File 'lib/canvas_sync/job_batches/status.rb', line 28 def completed_count job_count - pending end |
#created_at ⇒ Object
36 37 38 |
# File 'lib/canvas_sync/job_batches/status.rb', line 36 def created_at Batch.redis { |r| r.hget("BID-#{bid}", 'created_at') } end |
#data ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/canvas_sync/job_batches/status.rb', line 72 def data { bid: bid, failures: failures, pending: pending, created_at: created_at, complete: complete?, success: success?, failure_info: failure_info, parent_bid: parent_bid, child_count: child_count, completed_children_count: completed_children_count, successful_children_count: successful_children_count, failed_children_count: failed_children_count, } end |
#dead ⇒ Object
24 25 26 |
# File 'lib/canvas_sync/job_batches/status.rb', line 24 def dead Batch.redis { |r| r.scard("BID-#{bid}-dead") }.to_i end |
#failed_children_count ⇒ Object
68 69 70 |
# File 'lib/canvas_sync/job_batches/status.rb', line 68 def failed_children_count Batch.redis { |r| r.scard("BID-#{bid}-batches-failed") }.to_i end |
#failure_info ⇒ Object
44 45 46 |
# File 'lib/canvas_sync/job_batches/status.rb', line 44 def failure_info Batch.redis { |r| r.smembers("BID-#{bid}-failed") } || [] end |
#failures ⇒ Object
20 21 22 |
# File 'lib/canvas_sync/job_batches/status.rb', line 20 def failures Batch.redis { |r| r.scard("BID-#{bid}-failed") }.to_i end |
#job_count ⇒ Object
32 33 34 |
# File 'lib/canvas_sync/job_batches/status.rb', line 32 def job_count Batch.redis { |r| r.hget("BID-#{bid}", "job_count") }.to_i end |
#join ⇒ Object
12 13 14 |
# File 'lib/canvas_sync/job_batches/status.rb', line 12 def join raise "Not supported" end |
#parent_bid ⇒ Object
40 41 42 |
# File 'lib/canvas_sync/job_batches/status.rb', line 40 def parent_bid Batch.redis { |r| r.hget("BID-#{bid}", "parent_bid") } end |
#pending ⇒ Object
16 17 18 |
# File 'lib/canvas_sync/job_batches/status.rb', line 16 def pending Batch.redis { |r| r.hget("BID-#{bid}", 'pending') }.to_i end |