def abandon_execution_if_incomplete(liveaction_id, publish=True):
    liveaction_db = action_utils.get_liveaction_by_id(liveaction_id)
    # No need to abandon and already complete action
    if liveaction_db.status in action_constants.LIVEACTION_COMPLETED_STATES:
        raise ValueError('LiveAction %s already in a completed state %s.' %
                         (liveaction_id, liveaction_db.status))
    liveaction_db = action_utils.update_liveaction_status(
        status=action_constants.LIVEACTION_STATUS_ABANDONED,
        liveaction_db=liveaction_db,
        result={})
    execution_db = update_execution(liveaction_db, publish=publish)
    LOG.info('Marked execution %s as %s.', execution_db.id,
             action_constants.LIVEACTION_STATUS_ABANDONED)
    return execution_db
Marks execution as abandoned if it is still incomplete. Abandoning an
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/services/executions.py/abandon_execution_if_incomplete