lib/right_chimp/Chimp.rb in right_chimp-2.1.15 vs lib/right_chimp/Chimp.rb in right_chimp-2.1.17

- old
+ new

@@ -32,10 +32,11 @@ @concurrency = 1 @delay = 0 @retry_count = 0 @hold = false @timeout = 900 + @paused = false @limit_start = 0 @limit_end = 0 # @@ -413,11 +414,11 @@ puts VERSION exit 0 when '--chimpd' @use_chimpd = true unless arg.empty? - if arg =~ /[\d]+\.[\d]+\.[\d]+\.[\d]+:[\d]+/ + if arg =~ /[\d]+\.[\d]+\.[\d]+\.[\d]+:[\d]+/ @chimpd_host, @chimpd_port = arg.split(':') @chimpd_port = @chimpd_port.to_i else @chimpd_port = arg.to_i end @@ -989,17 +990,24 @@ failed_workers, results_display = get_results(group) # # If no workers failed, then we're done. # - return true if failed_workers.empty? - + if failed_workers.empty? + @paused = false + return "continue" + end # # Some workers failed; offer the user a chance to retry them # - verify("The following objects failed:", results_display, false) + verify("The following objects failed:", results_display, false) unless @paused + unless @prompt + @paused = true + return "pause" + end + while true puts "(R)etry failed jobs" puts "(A)bort chimp run" puts "(I)gnore errors and continue" command = gets() @@ -1011,11 +1019,11 @@ puts "Ignoring errors and continuing" exit 0 elsif command =~ /^r/i puts "Retrying..." ChimpQueue.instance.group[group].requeue_failed_jobs! - return false + return "retry" end end end # @@ -1181,15 +1189,19 @@ sleeping_counter += 5 sleep 5 end # - # If verify_results returns true, then ask chimpd to requeue all failed jobs. + # If verify_results returns false, then ask chimpd to requeue all failed jobs. # - if verify_results(@group) + case verify_results(@group) + when "continue" break - else + when "retry" ChimpDaemonClient.retry_group(@chimpd_host, @chimpd_port, @group) + when "pause" + @paused = true + #stuck in this loop until action is taken end end ensure #$stdout.print " done\n" end