lib/remote_run/runner.rb in remote_run-0.1.2 vs lib/remote_run/runner.rb in remote_run-0.1.3
- old
+ new
@@ -14,11 +14,10 @@
@starting_number_of_tasks = @task_manager.count
end
def run
setup_unlock_on_exit
- start_ssh_master_connections
sync_working_copy_to_temp_location
start_tasks
wait_for_tasks_to_finish
handle_results
end
@@ -32,14 +31,10 @@
end
end
end
end
- def start_ssh_master_connections
- @host_manager.start_ssh_master_connections
- end
-
def sync_working_copy_to_temp_location
log("Creating temporary copy of #{@configuration.local_path} in #{@configuration.temp_path}...")
excludes = @configuration.exclude.map { |dir| "--exclude '#{dir}'"}
system("rsync --delete --delete-excluded #{excludes.join(" ")} -aq #{@configuration.local_path}/ #{@configuration.temp_path}/")
log("Done.")
@@ -128,14 +123,10 @@
def check_for_finished
@children.each do |task|
child_pid = task.pid
if task_is_finished?(child_pid)
- unless $?.success?
- @failed << child_pid
- log("Task '#{task.command}' failed on #{task.host.hostname}")
- end
@results << $?.exitstatus
@children.delete(task)
end
end
end
@@ -143,10 +134,10 @@
def task_is_finished?(pid)
Process.waitpid(pid, Process::WNOHANG)
end
def display_log
- now = Time.now.strftime("%S")[0]
+ now = Time.now.strftime("%M")[0]
unless now == @last_timestamp
log("Waiting on #{@task_manager.count} of #{@starting_number_of_tasks} tasks to start.") if @task_manager.count > 0
log("Waiting on #{@children.length} of #{@starting_number_of_tasks - @task_manager.count} started tasks to finish. #{@failed.size} failed.") if @children.length > 0
$stdout.flush
@last_timestamp = now