Task failure handler

def task_failure_handler(task_id=None, exception=None,
                         traceback=None, args=None, **kwargs):
    """Task failure handler"""
    # 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)