def terminate_app(app_id, is_finished=False):
    """
    update app state to 'Terminated'
    """
    state = constant.STATE_APP_TERMINATED if is_finished else constant.STATE_APP_TERMINATING
    app_update_state(app_id, state)
    if is_finished:
        delete_app_info(app_id)