Skip to content

Problem: purge_transient_processing_data prints error messages #1714

@karinbredenberg

Description

@karinbredenberg

Expected behaviour
When using the management command purge_transient_processing_data, the database is cleared without error messages.

https://github.com/artefactual/archivematica/blob/qa/1.x/src/dashboard/src/main/management/commands/purge_transient_processing_data.py

Current behaviour
When using the command, the database is cleared but the following output is printed for every transfer:

Purging transfers...

» Transfer 5abfcc31-e0c4-4040-bd61-0c42fcfbd18e with status Done
Purging main.UnitVariable objects: 2 rows deleted.
Purging main.Task objects: 72 rows deleted.
Purging main.Job objects: 48 rows deleted.
Purging main.Transfer objects: 1 rows deleted.
Purging main.Directory objects: 4 rows deleted.
Purging search documents...
Error: 'UUID' object has no attribute 'replace'
Traceback (most recent call last):
File "/vagrant/src/archivematica/src/dashboard/src/main/management/commands/purge_transient_processing_data.py", line 185, in handle
es.remove_backlog_transfer_files(es_client, package_id)
File "/usr/lib/archivematica/archivematicaCommon/elasticSearchFunctions.py", line 1386, in remove_backlog_transfer_files
_remove_transfer_files(client, uuid, "transfer")
File "/usr/lib/archivematica/archivematicaCommon/elasticSearchFunctions.py", line 1404, in _remove_transfer_files
files = _document_ids_from_field_query(File "/usr/lib/archivematica/archivematicaCommon/elasticSearchFunctions.py", line 1255, in _document_ids_from_field_query
searchvalue = value.replace("/", "\/")
AttributeError: 'UUID' object has no attribute 'replace'

The error message is only printed under the “Purging transfers” step and not under “Purging SIPs”.

The command was used in the same way as shown in the documentation:

sudo -u archivematica bash -c " \ 
    set -a -e -x 
    source /etc/default/archivematica-dashboard || \ 
        source /etc/sysconfig/archivematica-dashboard \ 
            || (echo 'Environment file not found'; exit 1) 
    cd /usr/share/archivematica/dashboard 
    /usr/share/archivematica/virtualenvs/archivematica/bin/python \ 
        manage.py purge_transient_processing_data 
"; 

Steps to reproduce
Run the management command purge_transient_processing_data on a database that is not empty.

Your environment (version of Archivematica, operating system, other relevant details)
Archivematica 1.16.0
Storage Service 0.22.0
Ubuntu 22.04


For Artefactual use:

Before you close this issue, you must check off the following:

  • All pull requests related to this issue are properly linked
  • All pull requests related to this issue have been merged
  • A testing plan for this issue has been implemented and passed (testing plan information should be included in the issue body or comments)
  • Documentation regarding this issue has been written and merged (if applicable)
  • Details about this issue have been added to the release notes (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: reviewThe issue's code has been merged and is ready for testing/review.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions