Lifecycle Events â
Spored emits lifecycle events when significant things happen to a running instance. spored logs each event. Completion and Spot interruption can also be posted to a webhook you run; routing events to chat (Slack, Teams, Discord) through spore-bot is experimental and not part of 1.0.
Event types â
| Event | When it fires | Default message |
|---|---|---|
ttl_warning | 5 minutes before TTL expires | âąī¸ name terminates in 5 minutes |
ttl_expired | At TTL expiry | đ´ name has terminated â scheduled end time reached |
idle_warning | 5 minutes before idle timeout | đ¤ name will stop in 5 minutes â no activity detected |
idle_stopped | At idle timeout (default) | âšī¸ name has stopped â idle timeout reached |
idle_hibernated | At idle timeout with --on-idle hibernate | đ¤ name has hibernated â idle timeout reached |
idle_stop_failed | The idle stop or hibernate failed; the instance is still running and spored retries with backoff | âšī¸ name: idle_stop_failed |
completion | When spawn:completion-file is detected | â name has completed |
completion_stop_failed | The on-complete stop or hibernate failed; spored retries with backoff | âšī¸ name: completion_stop_failed |
spot_interrupt | On Spot interruption notice | â ī¸ name received a Spot interruption notice |
spot_replacement_retired | A replacement launched from a leaked Spot request was found and terminated (sent to the original instance's users) | âšī¸ name: spot_replacement_retired |
pre_stop_start | When pre-stop hook begins | đ name is running its shutdown task before terminating |
pre_stop_failed | The pre-stop hook exited with an error | đ name shutdown task FAILED â output may NOT have been saved |
pre_stop_timeout | The pre-stop hook ran past spawn:pre-stop-timeout | đ name shutdown task TIMED OUT â output may be incomplete |
fsx_mount_failed | The FSx filesystem could not be mounted | âšī¸ name: fsx_mount_failed |
fsx_dra_failed | The FSx data repository association (S3 link) could not be set up | âšī¸ name: fsx_dra_failed |
region_vacated | When an instance terminates and no other spawn-managed instance was running or pending in the region when the termination was decided, nor just before it terminates | âšī¸ name: region_vacated |
Events the bot has no dedicated message for are delivered in the generic âšī¸ form.
An instance tagged spawn:terminate-on-idle (a spawn service instance, a pool worker or a spawn burst member) is terminated at its idle timeout, not stopped, and that sends no event yet (spawn#1205). Users logged in to it still get spored's terminate warning. A cost-limit warning is not an event: at 90% of spawn:cost-limit, spored warns logged-in users with wall and writes /tmp/SPAWN_WARNING.
Receiving events â
- spored log: every event is reflected in
/var/log/spored.log(spawn logs <name> --which spored). - Your own webhook:
--completion-webhook-urland--spot-webhook-urlPOSTa fire-once notice forcompletionandspot_interrupt. - Chat (experimental, not part of 1.0): with a self-hosted spore-bot, set
--slack-workspaceat launch (plus--notify-platform teamsordiscord) and subscribe with/spore notify <nickname>. Without a subscription, events go to the channel webhook (if configured) but not as DMs. The hosted spore-bot is decommissioned.
Warning thresholds â
The 5-minute warning is fixed. If you need to respond (extend TTL, save work), you have that window. The warning fires once â subsequent checks within the same warning window don't re-trigger it.
Completion events â
The completion event fires when spored detects the file at spawn:completion-file (default: /tmp/SPAWN_COMPLETE, or the path you gave --completion-file). After the delay specified by spawn:completion-delay (default: 30s), it executes the action in spawn:on-complete.
A --command (or --mpi-command, on every member) writes the file itself when it exits, pass or fail, so you don't need to. It writes the path --completion-file names, creating its directory if needed (since spawn v0.135.2; before, it always wrote /tmp/SPAWN_COMPLETE, so a custom path never fired --on-complete). For work you start some other way, signal it at the end of your script:
touch /tmp/SPAWN_COMPLETESpored sees the file, sends the completion notification, waits 30 seconds, then terminates the instance.
spored checks for the file once a minute, so the instance terminates about 35â95 s after the file appears with the defaults (no pre-stop hook). The full breakdown is in How long after the command exits does the instance terminate?.
The region_vacated check never delays the termination (spored v0.153.0 and later, spawn#1456). Without a notifier it doesn't run. With one, it counts the region's other spawn-managed instances when the termination is decided and again just before it, so an instance relaunched in between suppresses the event; one launched after the termination does not.