IntegrityError when cleaning up an archived worker that is used both with and without a config
-
Create a worker.
-
Create a worker version on that worker.
-
Create a process.
-
Add the worker version to the process.
-
Create a worker configuration and assign it to the new worker run.
-
Add the worker version again, this time without a configuration.
-
Archive the worker.
-
Wait 30 days, or edit
cleanup.worker_delay
, or edit the worker'sarchived
date in the Django admin, so that it will be cleaned up. -
Run
arkindex cleanup
. -
Sentry Issue: ARKINDEX-BACKEND-28H
UniqueViolation: duplicate key value violates unique constraint "unique_workerrun" DETAIL: Key (process_id, version_id)=(767a8606-f290-4dc3-9758-1dc866463e5c, 7c90a439-f9b7-496f-8578-44cfe69f1cb8) already exists. File "django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) IntegrityError: duplicate key value violates unique constraint "unique_workerrun" DETAIL: Key (process_id, version_id)=(767a8606-f290-4dc3-9758-1dc866463e5c, 7c90a439-f9b7-496f-8578-44cfe69f1cb8) already exists. (14 additional frame(s) were not displayed) ... File "__main__.py", line 17, in <module> File "__main__.py", line 13, in main File "arkindex/manage.py", line 23, in main File "arkindex/documents/management/commands/cleanup.py", line 43, in handle File "arkindex/documents/management/commands/cleanup.py", line 307, in cleanup_archived_workers
-
Cry.