Method: Rake::RemoteTask::Action#execute
- Defined in:
- lib/rake_remote_task.rb
#execute(hosts, task, args) ⇒ Object
Execute this action on hosts
in parallel. Returns when block has completed for each host.
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/rake_remote_task.rb', line 585 def execute hosts, task, args hosts.each do |host| t = task.clone t.target_host = host thread = Thread.new(t) do |task| Thread.current[:task] = task case block.arity when 1 block.call task else block.call task, args end Thread.current[:task] = nil end @workers.add thread end @workers.list.each { |thr| thr.join } end |