def celery_teardown_request(error=None):
    if error is not None:
        _local.queue = []
        return
    try:
        if queue():
            if settings.USE_CELERY:
                group(queue()).apply_async()
            else:
                for task in queue():
                    task.apply()
    except __HOLE__:
        if not settings.DEBUG_MODE:
            logger.error('Task queue not initialized')
dataset/ETHPy150Open CenterForOpenScience/osf.io/framework/celery_tasks/handlers.py/celery_teardown_request