Class: Proxy::Dynflow::TaskLauncher::Batch

Inherits:
Abstract
  • Object
show all
Defined in:
lib/smart_proxy_dynflow/task_launcher/batch.rb

Direct Known Subclasses

AbstractGroup

Instance Attribute Summary

Attributes inherited from Abstract

#callback, #options, #results, #world

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, input_format

Constructor Details

This class inherits a constructor from Proxy::Dynflow::TaskLauncher::Abstract

Instance Method Details

#launch!(input) ⇒ Object



4
5
6
# File 'lib/smart_proxy_dynflow/task_launcher/batch.rb', line 4

def launch!(input)
  trigger(nil, Proxy::Dynflow::Action::Batch, self, input)
end

#launch_children(parent, input_hash) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/smart_proxy_dynflow/task_launcher/batch.rb', line 8

def launch_children(parent, input_hash)
  input_hash.each do |task_id, input|
    launcher = child_launcher(parent)
    launcher.launch!(transform_input(input))
    results[task_id] = launcher.results
  end
end

#prepare_batch(input_hash) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/smart_proxy_dynflow/task_launcher/batch.rb', line 16

def prepare_batch(input_hash)
  success_tasks = input_hash.select do |task_id, _input|
    results[task_id][:result] == 'success'
  end
  success_tasks.reduce({}) do |acc, (key, value)|
    acc.merge(results[key][:task_id] => value['action_input']['callback'])
  end
end