Conversation
Deploying geodatalytics with
|
| Latest commit: |
db4962e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9caf08cc.geodatalytics.pages.dev |
| Branch Preview URL: | https://task-errors.geodatalytics.pages.dev |
|
I'm struggling to review this in GitHub, because of all the indentation changes. I can load this in my editor and look more closely, but I have another idea for how to handle this. Let me know what you think. Giant It seems what we really care about is being notified of the exception so:
Note, 2 will naturally happen if we just allow an exception to bubble up unhandled. We could use Celery's class AnalysisTask(celery.Task):
def on_failure(self, exc, task_id, args, kwargs, einfo):
# All analysis tasks use this signature
task_result_id = args[0]
task_result = TaskResult.objects.get(pk=task_result_id)
# Could be a generic string, since the user doesn't need details
task_result.error = str(exc)
task_result.save()
@shared_task(base=AnalysisTask)
def ...This will allow tasks to formally "fail" (in the Celery sense) when they raise exceptions. This has a few implications:
|
Resolves #302