Skip to content

Commit

Permalink
Merge pull request #1260 from Amsterdam/123288/improvement-complete-t…
Browse files Browse the repository at this point in the history
…ask-logging

Add better logging when a task completion fails
  • Loading branch information
NvdLaan authored Aug 20, 2024
2 parents 9ea2282 + 63d5028 commit 7971d87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/main.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,18 @@ jobs:
run: docker network create top_and_zaak_backend_bridge
- name: Start images
run: docker compose -f docker-compose.local.yml up -d
- run: sleep 30
- name: Run Tests
run: docker compose -f docker-compose.local.yml exec -T zaak-gateway python manage.py test

- if: ${{ failure() }}
name: "ON FAILURE: Which containers were running while failing?"
run: docker ps -a

- if: ${{ failure() }}
name: "ON FAILURE: Backend logs"
run: docker logs zaken-backend-zaak-gateway-1

- if: ${{ failure() }}
name: "ON FAILURE: Database logs"
run: docker logs zaken-backend-database-1
6 changes: 6 additions & 0 deletions app/apps/workflow/signals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import datetime
import logging

import pytz
from apps.events.models import TaskModelEventEmitter
Expand All @@ -16,6 +17,8 @@
from .user_tasks import DEFAULT_USER_TASK_DUE_DATE, get_task_by_name
from .utils import get_latest_version_from_config

logger = logging.getLogger(__name__)


@receiver(pre_save, dispatch_uid="event_emitter_pre_save")
def event_emitter_pre_save(instance, **kwargs):
Expand All @@ -36,6 +39,9 @@ def event_emitter_pre_save(instance, **kwargs):
case_user_task_id=instance.case_user_task_id
)
if type_instance:
logger.error(
f"TaskModelEventEmitter of type '{instance.__class__.__name__}', with id '{instance.case_user_task_id}', already exists"
)
raise EventEmitterExistsError(
f"TaskModelEventEmitter of type '{instance.__class__.__name__}', with id '{instance.case_user_task_id}', already exists"
)
Expand Down

0 comments on commit 7971d87

Please sign in to comment.