{% if modelrun.state == 'running' or modelrun.state == 'cancelling' %} {% if modelrun.appears_stuck %}
Simulation Appears Stuck

This simulation hasn't updated in {{ modelrun.time_since_last_update }}. The worker process may have crashed or been terminated.

Common causes: Server restart, code changes during development, or worker crash.
You can use the Force Stop button above to mark this simulation as failed.

{% elif modelrun.has_progress %}
{% if modelrun.state == 'cancelling' %} Cancelling - Year {{ modelrun.current_progress.current_year }} {% else %} Simulating year {{ modelrun.current_progress.current_year }} {% endif %} {{ modelrun.current_progress.percentage_completed }}%
{% if modelrun.state == 'cancelling' %} Stopping simulation after current year completes... {% else %} Simulating from {{ modelrun.current_progress.start_year }} to {{ modelrun.current_progress.end_year }} {% endif %}
{% else %}
{% if modelrun.state == 'cancelling' %} Cancellation in progress, waiting for current operation to complete... {% else %} Simulation is starting up...
❤️ Heartbeat active - Last update: {{ modelrun.time_since_last_update }}
{% endif %}
{% endif %} {% elif modelrun.state == 'finished' %}
Simulation completed successfully! {% if modelrun.finished_at %}
Finished {{ modelrun.finished_at|timesince }} ago
{% endif %}
{% elif modelrun.state == 'failed' %}
Simulation failed {% if modelrun.error_message %}
Error: {{ modelrun.error_message|truncatewords:20 }}
{% endif %} {% if modelrun.finished_at %}
Failed {{ modelrun.finished_at|timesince }} ago
{% endif %}
{% elif modelrun.state == 'cancelled' %}
Simulation was cancelled {% if modelrun.finished_at %}
Cancelled {{ modelrun.finished_at|timesince }} ago
{% endif %}
{% else %}
No simulation in progress
{% endif %}