{#- 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. -#} {%- macro ago(sec) -%} {%- if sec < 90 -%}{{ sec }}s ago {%- elif sec < 5400 -%}{{ sec // 60 }}m ago {%- elif sec < 172800 -%}{{ sec // 3600 }}h ago {%- else -%}{{ sec // 86400 }}d ago{%- endif -%} {%- endmacro -%} {%- set e = s.last_error -%} {%- if s.crash_looping or s.failures_24h or (e and s.state != 'healthy') %}