@classmethod
@db.transactional
def mark_done(cls, ticket, status, result):
    if (status not in _ExternalTask._TERMINAL_STATUSES):
        raise TransitionError(('mark_done called with non-terminal status ' + status))
    task = cls._get_or_raise_not_found_error(ticket)
    task.result = result
    task.status = status
    db.put(task)
@classmethod
@db.transactional
def mark_done(cls, ticket, status, result):
    if (status not in _ExternalTask._TERMINAL_STATUSES):
        raise TransitionError(('mark_done called with non-terminal status ' + status))
    task = cls._get_or_raise_not_found_error(ticket)
    task.result = result
    task.status = status
    db.put(task)