Class: BatchProcessor::BatchDetails
- Inherits:
-
Spicerack::RedisModel
- Object
- Spicerack::RedisModel
- BatchProcessor::BatchDetails
- Defined in:
- lib/batch_processor/batch_details.rb
Instance Attribute Summary collapse
-
#batch_id ⇒ Object
readonly
Returns the value of attribute batch_id.
Class Method Summary collapse
Instance Method Summary collapse
- #finished_jobs_count ⇒ Object
-
#initialize(batch_id) ⇒ BatchDetails
constructor
A new instance of BatchDetails.
- #total_jobs_count ⇒ Object
- #unfinished_jobs_count ⇒ Object
Constructor Details
#initialize(batch_id) ⇒ BatchDetails
Returns a new instance of BatchDetails.
41 42 43 44 |
# File 'lib/batch_processor/batch_details.rb', line 41 def initialize(batch_id) @batch_id = batch_id super redis_key: self.class.redis_key_for_batch_id(batch_id) end |
Instance Attribute Details
#batch_id ⇒ Object (readonly)
Returns the value of attribute batch_id.
6 7 8 |
# File 'lib/batch_processor/batch_details.rb', line 6 def batch_id @batch_id end |
Class Method Details
.class_name_for_batch_id(batch_id) ⇒ Object
36 37 38 |
# File 'lib/batch_processor/batch_details.rb', line 36 def class_name_for_batch_id(batch_id) default_redis.hget(redis_key_for_batch_id(batch_id), "class_name") end |
.redis_key_for_batch_id(batch_id) ⇒ Object
32 33 34 |
# File 'lib/batch_processor/batch_details.rb', line 32 def redis_key_for_batch_id(batch_id) "#{name}::#{batch_id}" end |
Instance Method Details
#finished_jobs_count ⇒ Object
50 51 52 |
# File 'lib/batch_processor/batch_details.rb', line 50 def finished_jobs_count sum_up(:successful_jobs_count, :failed_jobs_count, :canceled_jobs_count) end |
#total_jobs_count ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/batch_processor/batch_details.rb', line 54 def total_jobs_count sum_up( :pending_jobs_count, :running_jobs_count, :successful_jobs_count, :failed_jobs_count, :canceled_jobs_count, :cleared_jobs_count, ) end |
#unfinished_jobs_count ⇒ Object
46 47 48 |
# File 'lib/batch_processor/batch_details.rb', line 46 def unfinished_jobs_count sum_up(:pending_jobs_count, :running_jobs_count) end |