Merge "Improve the gracefully stop debug messages" into stable/newton
This commit is contained in:
commit
128f61f636
|
@ -324,7 +324,7 @@ module Deployment
|
|||
}
|
||||
break result
|
||||
end
|
||||
gracefully_stop! if has_failed_critical_nodes?
|
||||
gracefully_stop! "failed_critical_nodes: #{failed_critical_nodes.inspect}" if has_failed_critical_nodes?
|
||||
|
||||
if all_nodes_are_finished?
|
||||
status = "All nodes are finished. Failed tasks: "\
|
||||
|
@ -579,13 +579,19 @@ digraph "<%= uid || 'graph' %>" {
|
|||
# @return [true, false]
|
||||
def gracefully_stop?
|
||||
return true if @emergency_brake
|
||||
if gracefully_stop_mark && gracefully_stop_mark.call
|
||||
info "Stop deployment by stop condition (external reason)"
|
||||
@emergency_brake = true
|
||||
end
|
||||
gracefully_stop_mark_check
|
||||
@emergency_brake
|
||||
end
|
||||
|
||||
# Run the gracefully_stop_mark condition block
|
||||
# and set the deployment to stop if the condition is met.
|
||||
def gracefully_stop_mark_check
|
||||
return unless gracefully_stop_mark
|
||||
if gracefully_stop_mark.call
|
||||
gracefully_stop! 'gracefully_stop_mark'
|
||||
end
|
||||
end
|
||||
|
||||
def gracefully_stop(node)
|
||||
if gracefully_stop? && node.ready?
|
||||
node.set_status_skipped
|
||||
|
@ -593,10 +599,13 @@ digraph "<%= uid || 'graph' %>" {
|
|||
end
|
||||
end
|
||||
|
||||
def gracefully_stop!
|
||||
# Set this deployment to gracefully stop
|
||||
# by marking all nodes to the skipped state instead of running
|
||||
# new tasks. Optionally, the reason of the stop can be provided.
|
||||
# @param [String] reason
|
||||
def gracefully_stop!(reason='unknown reason')
|
||||
return if @emergency_brake
|
||||
|
||||
info "Stop deployment by internal reason"
|
||||
warn "Setting the deployment to gracefully stop. Reason: #{reason}"
|
||||
@emergency_brake = true
|
||||
end
|
||||
|
||||
|
@ -611,7 +620,7 @@ digraph "<%= uid || 'graph' %>" {
|
|||
|
||||
if node.failed?
|
||||
count_tolerance_fail(node)
|
||||
gracefully_stop! if fault_tolerance_excess?
|
||||
gracefully_stop! "fault_tolerance: #{node.inspect}" if fault_tolerance_excess?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue