hook into status update messages (Issue #93)

django-3.2
Hartmut Holzgraefe 2023-09-26 19:18:17 +00:00
rodzic 77dba38814
commit 03a8ebe1f4
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -419,6 +419,10 @@ class JobRenderer(threading.Thread):
except Exception as e:
LOG.warning("PNG color reduction failed: %s" % e)
def _status_update(self, msg):
self.job.renderstep = msg
self.job.save()
def run(self):
"""Renders the given job, encapsulating all processing errors and
exceptions.
@ -438,6 +442,8 @@ class JobRenderer(threading.Thread):
result_file_prefix = os.path.join(RENDERING_RESULT_PATH, self.job.files_prefix())
os.makedirs(os.path.dirname(result_file_prefix), exist_ok=True)
config.status_update = self._status_update
# TODO have the create form provide this
config.origin_url = 'https://print.get-map.org' + self.job.get_absolute_url()

Wyświetl plik

@ -702,5 +702,5 @@ def api_rendering_status(request, id, nonce=None):
'refresh': refresh,
'progress': progress,
'queue_size': queue_size,
'status': 'working'
'status': job.renderstep or "working",
})