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.
      4 5 6  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 4 def bid @bid end  | 
  
Instance Method Details
#child_count ⇒ Object
      55 56 57  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 55 def child_count Batch.redis { |r| r.hget("BID-#{bid}", 'children') }.to_i end  | 
  
#complete? ⇒ Boolean
      47 48 49  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 47 def complete? 'true' == Batch.redis { |r| r.hget("BID-#{bid}", 'complete') } end  | 
  
#completed_children_count ⇒ Object
      59 60 61  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 59 def completed_children_count Batch.redis { |r| r.scard("BID-#{bid}-batches-complete") }.to_i end  | 
  
#completed_count ⇒ Object
      27 28 29  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 27 def completed_count job_count - pending end  | 
  
#created_at ⇒ Object
      35 36 37  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 35 def created_at Batch.redis { |r| r.hget("BID-#{bid}", 'created_at') } end  | 
  
#data ⇒ Object
      71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 71 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
      23 24 25  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 23 def dead Batch.redis { |r| r.scard("BID-#{bid}-dead") }.to_i end  | 
  
#failed_children_count ⇒ Object
      67 68 69  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 67 def failed_children_count Batch.redis { |r| r.scard("BID-#{bid}-batches-failed") }.to_i end  | 
  
#failure_info ⇒ Object
      43 44 45  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 43 def failure_info Batch.redis { |r| r.smembers("BID-#{bid}-failed") } || [] end  | 
  
#failures ⇒ Object
      19 20 21  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 19 def failures Batch.redis { |r| r.scard("BID-#{bid}-failed") }.to_i end  | 
  
#job_count ⇒ Object
      31 32 33  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 31 def job_count Batch.redis { |r| r.hget("BID-#{bid}", "job_count") }.to_i end  | 
  
#join ⇒ Object
      11 12 13  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 11 def join raise "Not supported" end  | 
  
#parent_bid ⇒ Object
      39 40 41  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 39 def parent_bid Batch.redis { |r| r.hget("BID-#{bid}", "parent_bid") } end  | 
  
#pending ⇒ Object
      15 16 17  | 
    
      # File 'lib/canvas_sync/job_batches/status.rb', line 15 def pending Batch.redis { |r| r.hget("BID-#{bid}", 'pending') }.to_i end  |