code: def task_failure_handler(task_id=None, exception=None,
                           traceback=None, args=None, **kwargs):
      
      # TODO: find a better way to acces workdir/archive/image
      task_report = {'task_id': task_id,
                     'exception': exception,
                     'traceback': traceback,
                     'archive': args[1]['archive_path'],
                     'image': args[1]['image']}
      notifier.send_task_failure_report(task_report)
      workdir = args[1]['workdir']
      remove_file(workdir)
docs: Task failure handler