def filemonitor_errback(task_id, monitor_pk): try: monitor = models.FileMonitor.objects.get(pk=monitor_pk) except Exception: logger.exception("Monitor error callback failed for pk={0}".format(monitor_pk)) return monitor.status = "Error" monitor.save()