Esempio n. 1
0
 def heartbeating_custom_error_activity(self, repeat_num):
     for i in range(repeat_num):
         time.sleep(0.2)
         try:
             get_context().heartbeat(str(i))
         except CancellationError:
             raise MySpecialCancelledError("spam")
Esempio n. 2
0
 def heartbeating_custom_error_activity(self, repeat_num):
     for i in range(repeat_num):
         time.sleep(0.2)
         try:
             get_context().heartbeat(str(i))
         except CancellationError:
             raise MySpecialCancelledError("spam")
Esempio n. 3
0
 def filter(self, record):
     try:
         if self._filter_replaying and botoflow.get_context().replaying:
             return 0
     except AttributeError:
         pass
     return 1
Esempio n. 4
0
 def filter(self, record):
     try:
         if self._filter_replaying and botoflow.get_context().replaying:
             return 0
     except AttributeError:
         pass
     return 1
    def _get_decision_context(self, calling_func):
        """Validates in decision context and returns it.

        :param calling_func: name of calling function
        :type calling_func: str
        :return: decision context
        :rtype: awsflow.context.DecisionContext
        :raises TypeError: if not in decision context
        """
        context = None
        try:
            context = get_context()
        except AttributeError:  # not in context
            pass

        if not isinstance(context, DecisionContext):
            raise TypeError("{}.{} can only be called in the decision "
                            "context".format(self.__class__.__name__, calling_func))
        return context
Esempio n. 6
0
    def _get_decision_context(self, calling_func):
        """Validates in decision context and returns it.

        :param calling_func: name of calling function
        :type calling_func: str
        :return: decision context
        :rtype: awsflow.context.DecisionContext
        :raises TypeError: if not in decision context
        """
        context = None
        try:
            context = get_context()
        except AttributeError:  # not in context
            pass

        if not isinstance(context, DecisionContext):
            raise TypeError("{}.{} can only be called in the decision "
                            "context".format(self.__class__.__name__,
                                             calling_func))
        return context
Esempio n. 7
0
    def perform_task(self, **kwargs):
        activity_context = get_context()
        task_token = activity_context.task.token

        with open('task_token.txt', 'w') as shared_file:
            shared_file.write(task_token)
Esempio n. 8
0
 def heartbeating_activity(self, repeat_num):
     for i in range(repeat_num):
         time.sleep(0.2)
         get_context().heartbeat(str(i))
Esempio n. 9
0
    def perform_task(self, **kwargs):
        activity_context = get_context()
        task_token = activity_context.task.token

        with open('task_token.txt', 'w') as shared_file:
            shared_file.write(task_token)
Esempio n. 10
0
 def heartbeating_activity(self, repeat_num):
     for i in range(repeat_num):
         time.sleep(0.2)
         get_context().heartbeat(str(i))