Celery error on restart of celery

Issue #632 resolved
David Platten created an issue

This is a long-standing error that takes place when celery is restarted on my server.

[2018-05-18 02:45:39,523: ERROR/MainProcess] Task remapp.netdicom.qrscu.movescu[7a0320c5-c267-42ed-8289-fd4bea03450f] raised unexpected: DoesNotExist('DicomQuery matching query does not exist.',)
Traceback (most recent call last):
  File "d:\server_apps\python27\lib\site-packages\celery\app\trace.py", line 368, in trace_task
    R = retval = fun(*args, **kwargs)
  File "d:\server_apps\python27\lib\site-packages\celery\app\trace.py", line 623, in __protected_call__
    return self.run(*args, **kwargs)
  File "D:\Server_Apps\python27\Lib\site-packages\openrem\remapp\netdicom\qrscu.py", line 870, in movescu
    query = DicomQuery.objects.get(query_id=query_id)
  File "d:\server_apps\python27\lib\site-packages\django\db\models\manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "d:\server_apps\python27\lib\site-packages\django\db\models\query.py", line 334, in get
Exception: DicomQuery matching query does not exist.

I think it could be caught by enclosing the move in a try-except, perhaps like this (line 870-ish of qrscu.py:

        query = DicomQuery.objects.get(query_id=query_id)
    except DicomQuery.objects.DoesNotExist:
        logger.debug(u"Query {0} does not exist. Deleting it.".format(query.query_id))

Comments (4)

  1. Log in to comment