Event > List of events > Lifecycle events >
stop
Source:
ops.StopEvent
This document describes the stop
event.
Contents:
Emission sequence
The stop
event is the one-before-last event a unit will ever see before going down, the last one being remove
. It is exclusively fired when the unit is in the Teardown phase.
The stop
event is emitted only once: when the Juju controller is ready to destroy the unit. When handling the stop
event, charms should gracefully terminate all services for the supported application and update any relevant cluster/leader information to remove or update any data relating to the current unit. Additionally, the charm should ensure that the software will not automatically start again on reboot.
Triggers
On kubernetes charms, the stop
event will occur on pod churn, when the unit dies. On machine charms, the stop event will be fired as part of the teardown sequence when a unit goes down.
Ways to force the occurrence of a stop
include:
juju remove-application
juju remove-unit
Observing this event in Ops
In ops
, you can observe the stop
event like you would any other:
self.framework.observe(self.on.stop, self._on_stop)
The stop
event object does not expose any specific attributes.