diff --git a/app/escriptorium/settings.py b/app/escriptorium/settings.py index 4f6471c79ba21d39cea427be34c4c4a6f3a7c5f9..4c1ebec8415d05b8725acb96e4f05eb0fbbfd42a 100644 --- a/app/escriptorium/settings.py +++ b/app/escriptorium/settings.py @@ -181,19 +181,21 @@ CELERY_RESULT_BACKEND = 'redis://%s:%d' % (REDIS_HOST, REDIS_PORT) CELERY_ACCEPT_CONTENT = ['application/json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' -CELERYD_ACKS_LATE = True +CELERY_ACKS_LATE = True # time in seconds a user has to wait after a task is started before being able to recover TASK_RECOVER_DELAY = 60 * 60 * 24 # 1 day CELERY_TASK_QUEUES = ( Queue('default', routing_key='default'), + Queue('live', routing_key='live'), # for everything that needs to be done on the spot to update the ui Queue('low-priority', routing_key='low-priority'), - Queue('gpu', routing_key='gpu'), + Queue('gpu', routing_key='gpu'), # for everything that could use a GPU ) CELERY_TASK_DEFAULT_QUEUE = 'default' CELERY_TASK_ROUTES = { # 'core.tasks.*': {'queue': 'default'}, + 'core.tasks.recalculate_masks': {'queue': 'live'}, 'core.tasks.generate_part_thumbnails': {'queue': 'low-priority'}, 'core.tasks.train': {'queue': 'gpu'}, 'core.tasks.segtrain': {'queue': 'gpu'}, diff --git a/app/escriptorium/templates/core/document_list.html b/app/escriptorium/templates/core/document_list.html index 4b881cf8e630f07076da04d33cc8e680ecabc498..3cd72eefb101f353d85d2c9e6a3e39abd3abb312 100644 --- a/app/escriptorium/templates/core/document_list.html +++ b/app/escriptorium/templates/core/document_list.html @@ -26,7 +26,6 @@ {% endwith %} </td> <th> - {# <a href="{% url 'document-detail' pk=document.pk %}">{{ document.name }}</a> #} {{ document.name }} {% if document.typology %}<br><span class="text-muted"><small>{{ document.typology|default_if_none:'-' }}</small></span>{% endif %} </th> @@ -47,20 +46,20 @@ </td> {% endcomment %} <td class="text-right"> - {# <a href="{% url 'document-detail' pk=document.pk %}" class="btn btn-info disabled" title="{% trans 'View' %}"><i class="fas fa-eye"></i></a> #} - {# Note that doing one query per row is a lot faster than a subquery for some reason #} - {% if document.last_edited_part %} - <a href="{% url 'document-part-edit' pk=document.pk part_pk=document.last_edited_part.pk %}" - class="btn btn-info" - title="{% trans 'Edit last updated Element' %}"> - <i class="fas fa-edit"></i> - </a> - {% endif %} + {# <a href="{% url 'document-detail' pk=document.pk %}" class="btn btn-info disabled" title="{% trans 'View' %}"><i class="fas fa-eye"></i></a> #} + {# Note that doing one query per row is a lot faster than a subquery for some reason #} + {% if document.last_edited_part %} + <a href="{% url 'document-part-edit' pk=document.pk part_pk=document.last_edited_part.pk %}" + class="btn btn-info" + title="{% trans 'Edit last updated Element' %}"> + <i class="fas fa-edit"></i> + </a> + {% endif %} - <form method="post" class="inline-form" action="{% url 'document-publish' pk=document.pk %}" onsubmit="return confirm('{% trans "Do you really want to delete the document?" %}');">{% csrf_token %} - <input type="hidden" name="workflow_state" value="{{ document.WORKFLOW_STATE_ARCHIVED }}"> - <button type="submit" value="" class="nav-item btn btn-danger" title="{% trans 'Delete' %}"><i class="fas fa-trash"></i></button> - </form> + <form method="post" class="inline-form" action="{% url 'document-publish' pk=document.pk %}" onsubmit="return confirm('{% trans "Do you really want to delete the document?" %}');">{% csrf_token %} + <input type="hidden" name="workflow_state" value="{{ document.WORKFLOW_STATE_ARCHIVED }}"> + <button type="submit" value="" onclick='event.stopPropagation();' class="nav-item btn btn-danger" title="{% trans 'Delete' %}"><i class="fas fa-trash"></i></button> + </form> </td> </tr> {% endfor %} diff --git a/docker-compose.yml b/docker-compose.yml index 6a3de0b94ee7816f552907e350b272416e485b68..f8f155c8789579ec25ded7040881e93d8e578c79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,6 +73,10 @@ services: - OMP_NUM_THREADS=1 command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q default -c ${CELERY_MAIN_CONC:-10} --max-tasks-per-child=10" + celery-live: + <<: *app + command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q live -c ${CELERY_LIVE_CONC:-10} --max-tasks-per-child=10" + celery-low-priority: <<: *app command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q low-priority -c ${CELERY_LOW_CONC:-10} --max-tasks-per-child=10"