Class: MedPipe::PipelinePlanProducer
- Inherits:
-
Object
- Object
- MedPipe::PipelinePlanProducer
- Defined in:
- lib/med_pipe/pipeline_plan_producer.rb
Overview
prioryty が高いものから順に、並列数を踏まえて複数のPipelinePlanの状態をenqueuedに変更する
Instance Method Summary collapse
-
#initialize(pipeline_group) ⇒ PipelinePlanProducer
constructor
A new instance of PipelinePlanProducer.
-
#run ⇒ Array<MedPipe::PipelinePlan>
Enqueued pipeline plans.
Constructor Details
#initialize(pipeline_group) ⇒ PipelinePlanProducer
Returns a new instance of PipelinePlanProducer.
6 7 8 |
# File 'lib/med_pipe/pipeline_plan_producer.rb', line 6 def initialize(pipeline_group) @pipeline_group = pipeline_group end |
Instance Method Details
#run ⇒ Array<MedPipe::PipelinePlan>
Returns Enqueued pipeline plans. 未実行ならnilを返す.
11 12 13 14 15 16 17 18 |
# File 'lib/med_pipe/pipeline_plan_producer.rb', line 11 def run return if @pipeline_group.parallel_limit <= 0 @pipeline_group.with_lock do enqueue_count = @pipeline_group.parallel_limit - @pipeline_group.pipeline_plans.active.count enqueue(enqueue_count) if enqueue_count.positive? end end |