Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b83a5fa291 | |||
| 6e2ff28d59 |
@@ -131,6 +131,8 @@ models:
|
|||||||
|
|
||||||
# use a custom command to stop the model when swapping. By default
|
# use a custom command to stop the model when swapping. By default
|
||||||
# this is SIGTERM on POSIX systems, and taskkill on Windows systems
|
# this is SIGTERM on POSIX systems, and taskkill on Windows systems
|
||||||
|
# the ${PID} variable can be used in cmdStop, it will be automatically replaced
|
||||||
|
# with the PID of the running model
|
||||||
cmdStop: docker stop dockertest
|
cmdStop: docker stop dockertest
|
||||||
|
|
||||||
# Groups provide advanced controls over model swapping behaviour. Using groups
|
# Groups provide advanced controls over model swapping behaviour. Using groups
|
||||||
|
|||||||
+12
-3
@@ -149,7 +149,9 @@ func isValidTransition(from, to ProcessState) bool {
|
|||||||
return to == StateStopping
|
return to == StateStopping
|
||||||
case StateStopping:
|
case StateStopping:
|
||||||
return to == StateStopped || to == StateShutdown
|
return to == StateStopped || to == StateShutdown
|
||||||
case StateFailed, StateShutdown:
|
case StateFailed:
|
||||||
|
return to == StateStopping
|
||||||
|
case StateShutdown:
|
||||||
return false // No transitions allowed from these states
|
return false // No transitions allowed from these states
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -359,13 +361,20 @@ func (p *Process) StopImmediately() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
p.proxyLogger.Debugf("<%s> Stopping process", p.ID)
|
p.proxyLogger.Debugf("<%s> Stopping process, current state: %s", p.ID, p.CurrentState())
|
||||||
|
currentState := p.CurrentState()
|
||||||
|
|
||||||
// calling Stop() when state is invalid is a no-op
|
if currentState == StateFailed {
|
||||||
|
if curState, err := p.swapState(StateFailed, StateStopping); err != nil {
|
||||||
|
p.proxyLogger.Infof("<%s> Stop() Failed -> StateStopping err: %v, current state: %v", p.ID, err, curState)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if curState, err := p.swapState(StateReady, StateStopping); err != nil {
|
if curState, err := p.swapState(StateReady, StateStopping); err != nil {
|
||||||
p.proxyLogger.Infof("<%s> Stop() Ready -> StateStopping err: %v, current state: %v", p.ID, err, curState)
|
p.proxyLogger.Infof("<%s> Stop() Ready -> StateStopping err: %v, current state: %v", p.ID, err, curState)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// stop the process with a graceful exit timeout
|
// stop the process with a graceful exit timeout
|
||||||
p.stopCommand(p.gracefulStopTimeout)
|
p.stopCommand(p.gracefulStopTimeout)
|
||||||
|
|||||||
@@ -352,6 +352,8 @@ func (pm *ProxyManager) upstreamIndex(c *gin.Context) {
|
|||||||
stateStr = "Failed"
|
stateStr = "Failed"
|
||||||
case StateShutdown:
|
case StateShutdown:
|
||||||
stateStr = "Shutdown"
|
stateStr = "Shutdown"
|
||||||
|
case StateStopped:
|
||||||
|
stateStr = "Stopped"
|
||||||
default:
|
default:
|
||||||
stateStr = "Unknown"
|
stateStr = "Unknown"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user