def put(self, id, liveaction_api, requester_user, show_secrets=False):
        """
        Updates a single execution.

        Handles requests:
            PUT /executions/<id>

        """
        if not requester_user:
            requester_user = UserDB(name=cfg.CONF.system_user.user)

        from_model_kwargs = {
            "mask_secrets": self._get_mask_secrets(
                requester_user, show_secrets=show_secrets
            )
        }

        execution_api = self._get_one_by_id(
            id=id,
            requester_user=requester_user,
            from_model_kwargs=from_model_kwargs,
            permission_type=PermissionType.EXECUTION_STOP,
        )

        if not execution_api:
            abort(http_client.NOT_FOUND, "Execution with id %s not found." % id)

        liveaction_id = execution_api.liveaction["id"]
        if not liveaction_id:
            abort(
                http_client.INTERNAL_SERVER_ERROR,
                "Execution object missing link to liveaction %s." % liveaction_id,
            )

        try:
            liveaction_db = LiveAction.get_by_id(liveaction_id)
        except:
            abort(
                http_client.INTERNAL_SERVER_ERROR,
                "Execution object missing link to liveaction %s." % liveaction_id,
            )

        if liveaction_db.status in action_constants.LIVEACTION_COMPLETED_STATES:
            abort(http_client.BAD_REQUEST, "Execution is already in completed state.")

        def update_status(liveaction_api, liveaction_db):
            status = liveaction_api.status
            result = getattr(liveaction_api, "result", None)
            liveaction_db = action_service.update_status(
                liveaction_db, status, result, set_result_size=True
            )
            actionexecution_db = ActionExecution.get(
                liveaction__id=str(liveaction_db.id)
            )
            return (liveaction_db, actionexecution_db)

        try:
            if (
                liveaction_db.status == action_constants.LIVEACTION_STATUS_CANCELING
                and liveaction_api.status == action_constants.LIVEACTION_STATUS_CANCELED
            ):
                if action_service.is_children_active(liveaction_id):
                    liveaction_api.status = action_constants.LIVEACTION_STATUS_CANCELING
                liveaction_db, actionexecution_db = update_status(
                    liveaction_api, liveaction_db
                )
            elif (
                liveaction_api.status == action_constants.LIVEACTION_STATUS_CANCELING
                or liveaction_api.status == action_constants.LIVEACTION_STATUS_CANCELED
            ):
                liveaction_db, actionexecution_db = action_service.request_cancellation(
                    liveaction_db, requester_user.name or cfg.CONF.system_user.user
                )
            elif (
                liveaction_db.status == action_constants.LIVEACTION_STATUS_PAUSING
                and liveaction_api.status == action_constants.LIVEACTION_STATUS_PAUSED
            ):

                if action_service.is_children_active(liveaction_id):
                    liveaction_api.status = action_constants.LIVEACTION_STATUS_PAUSING
                liveaction_db, actionexecution_db = update_status(
                    liveaction_api, liveaction_db
                )
            elif (
                liveaction_api.status == action_constants.LIVEACTION_STATUS_PAUSING
                or liveaction_api.status == action_constants.LIVEACTION_STATUS_PAUSED
            ):
                liveaction_db, actionexecution_db = action_service.request_pause(
                    liveaction_db, requester_user.name or cfg.CONF.system_user.user
                )
            elif liveaction_api.status == action_constants.LIVEACTION_STATUS_RESUMING:
                liveaction_db, actionexecution_db = action_service.request_resume(
                    liveaction_db, requester_user.name or cfg.CONF.system_user.user
                )
            else:
                liveaction_db, actionexecution_db = update_status(
                    liveaction_api, liveaction_db
                )
        except runner_exc.InvalidActionRunnerOperationError as e:
            LOG.exception(
                "Failed updating liveaction %s. %s", liveaction_db.id, six.text_type(e)
            )
            abort(
                http_client.BAD_REQUEST,
                "Failed updating execution. %s" % six.text_type(e),
            )
        except runner_exc.UnexpectedActionExecutionStatusError as e:
            LOG.exception(
                "Failed updating liveaction %s. %s", liveaction_db.id, six.text_type(e)
            )
            abort(
                http_client.BAD_REQUEST,
                "Failed updating execution. %s" % six.text_type(e),
            )
        except Exception as e:
            LOG.exception(
                "Failed updating liveaction %s. %s", liveaction_db.id, six.text_type(e)
            )
            abort(
                http_client.INTERNAL_SERVER_ERROR,
                "Failed updating execution due to unexpected error.",
            )

        mask_secrets = self._get_mask_secrets(requester_user, show_secrets=show_secrets)
        execution_api = ActionExecutionAPI.from_model(
            actionexecution_db, mask_secrets=mask_secrets
        )

        return execution_api

        Updates a single execution.

        Handles requests:
            PUT /executions/<id>

        
st2api/st2api/controllers/v1/actionexecutions.py