Skip to content

Commit

Permalink
Merge pull request #82 from OmarWKH/print-unknown-state
Browse files Browse the repository at this point in the history
Log and print unknown state
  • Loading branch information
czue authored Mar 26, 2021
2 parents 932d2b7 + 807da7b commit 4b1e023
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion celery_progress/backend.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import datetime
import logging
from abc import ABCMeta, abstractmethod
from decimal import Decimal

from celery.result import EagerResult, allow_join_result
from celery.backends.base import DisabledBackend

logger = logging.getLogger(__name__)

PROGRESS_STATE = 'PROGRESS'

Expand Down Expand Up @@ -102,11 +104,12 @@ def get_info(self):
'progress': _get_unknown_progress(self.result.state),
})
else:
logger.error('Task %s has unknown state %s with metadata %s', self.result.id, self.result.state, self.result.info)
response.update({
'complete': True,
'success': False,
'progress': _get_unknown_progress(self.result.state),
'result': 'Unknown state {}'.format(str(self.result.info)),
'result': 'Unknown state {}'.format(self.result.state),
})
return response

Expand Down

0 comments on commit 4b1e023

Please sign in to comment.