Skip to content

Commit

Permalink
Merge pull request #76 from rightscale/OPS-2859_wait_until_to_honor_n…
Browse files Browse the repository at this point in the history
…o_prompt

OPS-2859 make wait-until honor no prompt flag
  • Loading branch information
Marc committed Jun 4, 2016
2 parents fd1fa83 + 83fe26e commit 5728eb8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
6 changes: 5 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,8 @@ Version 2.1.13

Version 2.1.15
---------------
* Feature: We now are able to query a subset of job_uuids and total stats format.
* Feature: We now are able to query a subset of job_uuids and total stats format.

Version 2.1.16
--------------
* Bugfix: chimp --wait-until-done now honors the noprompt flag.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
right_chimp (2.1.15)
right_chimp (2.1.16)
highline (~> 1.7.2)
nokogiri (~> 1.6.7.1)
progressbar (~> 0.11.0)
Expand Down Expand Up @@ -68,4 +68,4 @@ DEPENDENCIES
rspec (~> 2.6.0)

BUNDLED WITH
1.10.6
1.12.4
28 changes: 20 additions & 8 deletions lib/right_chimp/Chimp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def initialize
@retry_count = 0
@hold = false
@timeout = 900
@paused = false

@limit_start = 0
@limit_end = 0
Expand Down Expand Up @@ -415,7 +416,7 @@ def parse_command_line
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
Expand Down Expand Up @@ -991,12 +992,19 @@ def verify_results(group = :default)
#
# 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"
Expand All @@ -1013,7 +1021,7 @@ def verify_results(group = :default)
elsif command =~ /^r/i
puts "Retrying..."
ChimpQueue.instance.group[group].requeue_failed_jobs!
return false
return "retry"
end
end
end
Expand Down Expand Up @@ -1183,12 +1191,16 @@ def chimpd_wait_until_done
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
Expand Down
2 changes: 1 addition & 1 deletion lib/right_chimp/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Chimp
VERSION = "2.1.15"
VERSION = "2.1.16"
end

0 comments on commit 5728eb8

Please sign in to comment.