Module: Omnitest::RunAction
- Included in:
- Omnitest, Command::ProjectAction, Command::ScenarioAction, Command::Task, Command::Test
- Defined in:
- lib/omnitest/run_action.rb
Defined Under Namespace
Classes: Worker
Instance Method Summary collapse
-
#run_action(collection, action, pool_size, *args) ⇒ Object
Run an action on each member of the collection.
Instance Method Details
#run_action(collection, action, pool_size, *args) ⇒ Object
Run an action on each member of the collection. The collection could be Projects (e.g. clone, bootstrap) or Scenarios (e.g. test, clean). The instance actions will take place in a seperate thread of execution which may or may not be running concurrently.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/omnitest/run_action.rb', line 25 def run_action(collection, action, pool_size, *args) pool_size ||= 1 pool_size = collection.size if pool_size > collection.size if pool_size > 1 Celluloid::Actor[:omnitest_worker] = Worker.pool(size: pool_size) else Worker.supervise_as :omnitest_worker end # futures = collection.each_with_index.map do |item, index| collection.each_with_index.map do |item, index| actor = Celluloid::Actor[:omnitest_worker] actor.work(item, action, index, *args) # actor.future.work(item, action, index, *args) end # futures.map(&:value) end |