Improve the gracefully stop debug messages
Change-Id: I736aebefbeba7fd1ddaa0ce844a53999d346d7fd
(cherry picked from commit b78e52d204
)
This commit is contained in:
parent
0b9c778325
commit
96e535ae2c
|
@ -324,7 +324,7 @@ module Deployment
|
||||||
}
|
}
|
||||||
break result
|
break result
|
||||||
end
|
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?
|
if all_nodes_are_finished?
|
||||||
status = "All nodes are finished. Failed tasks: "\
|
status = "All nodes are finished. Failed tasks: "\
|
||||||
|
@ -585,13 +585,19 @@ digraph "<%= uid || 'graph' %>" {
|
||||||
# @return [true, false]
|
# @return [true, false]
|
||||||
def gracefully_stop?
|
def gracefully_stop?
|
||||||
return true if @emergency_brake
|
return true if @emergency_brake
|
||||||
if gracefully_stop_mark && gracefully_stop_mark.call
|
gracefully_stop_mark_check
|
||||||
info "Stop deployment by stop condition (external reason)"
|
|
||||||
@emergency_brake = true
|
|
||||||
end
|
|
||||||
@emergency_brake
|
@emergency_brake
|
||||||
end
|
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
|
||||||
|
|
||||||
# If the deployment is being gracefully stopped
|
# If the deployment is being gracefully stopped
|
||||||
# set the node to the skipped state so it will
|
# set the node to the skipped state so it will
|
||||||
# excluded from the deployment process.
|
# excluded from the deployment process.
|
||||||
|
@ -602,10 +608,13 @@ digraph "<%= uid || 'graph' %>" {
|
||||||
end
|
end
|
||||||
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
|
return if @emergency_brake
|
||||||
|
warn "Setting the deployment to gracefully stop. Reason: #{reason}"
|
||||||
info "Stop deployment by internal reason"
|
|
||||||
@emergency_brake = true
|
@emergency_brake = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -625,7 +634,7 @@ digraph "<%= uid || 'graph' %>" {
|
||||||
return if gracefully_stop?
|
return if gracefully_stop?
|
||||||
if node.failed?
|
if node.failed?
|
||||||
count_tolerance_fail(node)
|
count_tolerance_fail(node)
|
||||||
gracefully_stop! if fault_tolerance_excess?
|
gracefully_stop! "fault_tolerance: #{node.inspect}" if fault_tolerance_excess?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue