{#- One line on a swarm service's task failures, from Swarm's own task records (agent ≥ 1.8.0): a crash loop or the failures of the last 24h, and how the newest troubled task ended, in Swarm's words. Expects `s` with state, crash_looping, failures_1h, failures_24h and last_error; `style` is optional extra CSS for the wrapper. Renders nothing for a healthy service with no recent failures. -#} {%- set e = s.last_error -%} {%- if s.crash_looping or s.failures_24h or (e and s.state != 'healthy') %}
{% if s.crash_looping %} Crash-looping · {{ s.failures_1h }} tasks failed in the last hour {% elif s.failures_24h %} {{ s.failures_24h }} task{{ 's' if s.failures_24h != 1 }} failed in the last 24h {% endif %} {% if e %} Last task {{ e.state }}: {{ e.error or e.message or e.state }} {%- if e.exit_code %} · exit {{ e.exit_code }}{% endif %} {%- if e.node %} · {{ e.node }}{% endif %} {%- if e.age_s is not none %} · {{ e.age_s|duration }} ago{% endif %} {% endif %}
{%- endif %}