Exemplo n.º 1
0
    def test_jumbo_fields_encoding_raise_if_encoded_form_overflows_thresholds(self):
        # 'reason' field is limited to 256 chars for instance
        self.setup_jumbo_fields("jumbo-bucket/with/a/very/long/name/" + "a" * 256)

        message = 'A' * 500
        with self.assertRaisesRegexp(ValueError, "Jumbo field signature is longer than"):
            format.reason(message)
Exemplo n.º 2
0
    def test_jumbo_fields_encoding_raise_if_encoded_form_overflows_thresholds(self):
        # 'reason' field is limited to 256 chars for instance
        self.setup_jumbo_fields("jumbo-bucket/with/a/very/long/name/" + "a" * 256)

        message = 'A' * 500
        with self.assertRaisesRegexp(ValueError, "Jumbo field signature is longer than"):
            format.reason(message)
Exemplo n.º 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)
Exemplo n.º 4
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)
Exemplo n.º 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),
     )
Exemplo n.º 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),}
        )
Exemplo n.º 7
0
 def terminate(self, reason=None, details=None):
     self.update_attributes(
         {"reason": format.reason(reason), "details": format.details(details),}
     )
Exemplo n.º 8
0
 def terminate(self, reason=None, details=None):
     self.update_attributes({
         'reason': format.reason(reason),
         'details': format.details(details),
     })