Skip to content

Commit

Permalink
Try to catch / workaround 5215 (#5216)
Browse files Browse the repository at this point in the history
Fixes #5215

It's not really clear how the error can be obtained, but this PR adds a
workaround for the problem. There are 2 possible ways to get the
`message` parameter - from an error and from the operation status.

- Our status messages are always represented by a string, no any other
values is assigned.

- rq is trickier here - it receives rq data and [decodes
it](https://github.com/rq/rq/blob/master/rq/job.py#L603-L609) if there
is an error, but the operations can leave None as the `exc_info` value.
Maybe [this issue](rq/rq#1633) is relevant
here.
  • Loading branch information
zhiltsov-max authored Dec 3, 2022
1 parent d4788ee commit 2a2c43f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,10 +1221,14 @@ def _get_rq_response(queue, job_id):
elif job.is_queued:
response = { "state": "Queued" }
elif job.is_failed:
response = { "state": "Failed", "message": job.exc_info }
# FIXME: It seems that in some cases exc_info can be None.
# It's not really clear how it is possible, but it can
# lead to an error in serializing the response
# https://github.com/opencv/cvat/issues/5215
response = { "state": "Failed", "message": job.exc_info or "Unknown error" }
else:
response = { "state": "Started" }
if 'status' in job.meta:
if job.meta.get('status'):
response['message'] = job.meta['status']
response['progress'] = job.meta.get('task_progress', 0.)

Expand Down

0 comments on commit 2a2c43f

Please sign in to comment.