Пример #1
0
    def cancel(self, task_token, details=None):
        """Responds to ``swf`` that the activity task was canceled

        :param  task_token: canceled activity task token
        :type   task_token: string

        :param  details: provided details about cancel
        :type   details: string
        """
        try:
            return self.connection.respond_activity_task_canceled(
                task_token,
                details=format.details(details),
            )
        except boto.exception.SWFResponseError as e:
            message = self.get_error_message(e)
            if e.error_code == 'UnknownResourceFault':
                raise DoesNotExistError(
                    "Unable to cancel activity task with token={}".format(
                        task_token),
                    message,
                )
            raise ResponseError(message)
        finally:
            logging_context.reset()
Пример #2
0
    def fail(self, task_token, details=None, reason=None):
        """Replies to ``swf`` that the activity task failed

        :param  task_token: canceled activity task token
        :type   task_token: string

        :param  details: provided details about the failure
        :type   details: string

        :param  reason: Description of the error that may assist in diagnostics
        :type   reason: string
        """
        try:
            return self.connection.respond_activity_task_failed(
                task_token,
                details=format.details(details),
                reason=format.reason(reason),
            )
        except boto.exception.SWFResponseError as e:
            message = self.get_error_message(e)
            if e.error_code == "UnknownResourceFault":
                raise DoesNotExistError(
                    "Unable to fail activity task with token={}".format(task_token),
                    message,
                )

            raise ResponseError(message)
Пример #3
0
    def fail(self, task_token, details=None, reason=None):
        """Replies to ``swf`` that the activity task failed

        :param  task_token: canceled activity task token
        :type   task_token: string

        :param  details: provided details about the failure
        :type   details: string

        :param  reason: Description of the error that may assist in diagnostics
        :type   reason: string
        """
        try:
            return self.connection.respond_activity_task_failed(
                task_token,
                details=format.details(details),
                reason=format.reason(reason),
            )
        except boto.exception.SWFResponseError as e:
            message = self.get_error_message(e)
            if e.error_code == 'UnknownResourceFault':
                raise DoesNotExistError(
                    "Unable to fail activity task with token={}".format(task_token),
                    message,
                )

            raise ResponseError(message)
Пример #4
0
    def cancel(self, details=None):
        """Cancel workflow execution decision builder

        :param  details: Optional details of the cancellation
        :type   details: Optional[Any]
        """
        self.update_attributes(
            {"details": format.details(details),}
        )
Пример #5
0
 def terminate(self, child_policy=None, details=None, reason=None):
     """Terminates the workflow execution"""
     self.connection.terminate_workflow_execution(
         self.domain.name,
         self.workflow_id,
         run_id=self.run_id,
         child_policy=child_policy,
         details=format.details(details),
         reason=format.reason(reason),
     )
Пример #6
0
    def fail(self, details=None, reason=None):
        """Fail workflow execution decision builder

        :param  details: Optional details of the failure
        :type   details: Optional[Any]

        :param  reason: A descriptive reason for the failure that may help in diagnostics
        :type   reason: Optional[str]
        """
        self.update_attributes(
            {"details": format.details(details), "reason": format.reason(reason),}
        )
Пример #7
0
    def cancel(self, task_token, details=None):
        """Responds to ``swf`` that the activity task was canceled

        :param  task_token: canceled activity task token
        :type   task_token: string

        :param  details: provided details about cancel
        :type   details: string
        """
        try:
            return self.connection.respond_activity_task_canceled(
                task_token,
                details=format.details(details),
            )
        except boto.exception.SWFResponseError as e:
            message = self.get_error_message(e)
            if e.error_code == 'UnknownResourceFault':
                raise DoesNotExistError(
                    "Unable to cancel activity task with token={}".format(task_token),
                    message,
                )
            raise ResponseError(message)
        finally:
            logging_context.reset()
Пример #8
0
 def terminate(self, reason=None, details=None):
     self.update_attributes(
         {"reason": format.reason(reason), "details": format.details(details),}
     )
Пример #9
0
 def terminate(self, reason=None, details=None):
     self.update_attributes({
         'reason': format.reason(reason),
         'details': format.details(details),
     })