def execute(self):
     activity_future = self.activities_client.heartbeating_activity(
         5)
     yield workflow_time.sleep(2)
     activity_future._activity_id = '100'  # set invalid ID
     yield activity_future.cancel()
     return_(False)
 def execute(self):
     try:
         instance = yield TimingOutChildWorkflow.execute()
         yield instance.workflow_result
     except ChildWorkflowTimedOutError:
         return_(1)
     return_(2)
    def run(self, x, y):
        retval = None
        sum_result = yield BunchOfActivities.sum(x, y)
        if sum_result > 2:
            retval = yield BunchOfActivities.mul(retval, 2)

        return_(retval)
Exemple #4
0
 def execute(self):
     try:
         instance = yield TimingOutChildWorkflow.execute()
         yield instance.workflow_result
     except ChildWorkflowTimedOutError:
         return_(1)
     return_(2)
Exemple #5
0
 def execute(self):
     try:
         external_wf = WorkflowDefinition(WorkflowExecution('fake', 'fake'))
         yield external_wf.cancel()
     except RequestCancelExternalWorkflowExecutionFailedError:
         return_('pass')
     return_('fail')
 def execute(self):
     try:
         external_wf = WorkflowDefinition(WorkflowExecution('fake', 'fake'))
         yield external_wf.cancel()
     except RequestCancelExternalWorkflowExecutionFailedError:
         return_('pass')
     return_('fail')
 def execute(self):
     activity_future = self.activities_client.wrong_tasklist_activity(
     )
     yield workflow_time.sleep(2)
     yield activity_future.cancel()
     yield activity_future
     return_(False)
    def run(self, x, y):
        retval = None
        sum_result = yield BunchOfActivities.sum(x, y)
        if sum_result > 2:
            retval = yield BunchOfActivities.mul(retval, 2)

        return_(retval)
 def execute(self):
     activity_future = self.activities_client.heartbeating_activity(
         10)
     yield workflow_time.sleep(2)
     yield activity_future.cancel()
     yield activity_future
     return_(False)
Exemple #10
0
 def execute(self, child_task_list):
     with workflow_options(task_list=child_task_list):
         instance = yield CancelChildWorkflowsChildWorkflow.execute()
         yield instance.cancel()
         try:
             yield instance.workflow_result
         except CancelledError:
             return_('pass')
Exemple #11
0
 def execute(self):
     activity_future = self.activities_client.heartbeating_activity(2)
     yield activity_future.cancel()
     try:
         yield activity_future
     except CancelledError:
         pass
     return_(False)
 def execute(self, child_task_list):
     with workflow_options(task_list=child_task_list):
         instance = yield CancelChildWorkflowsChildWorkflow.execute()
         yield instance.cancel()
         try:
             yield instance.workflow_result
         except CancelledError:
             return_('pass')
 def execute(self):
     activity_future = self.activities_client.heartbeating_activity(2)
     yield activity_future.cancel()
     try:
         yield activity_future
     except CancelledError:
         pass
     return_(False)
Exemple #14
0
 def execute(self, child_tasklist):
     try:
         with workflow_options(task_list=child_tasklist):
             instance = yield RaisingChildWorkflow.execute()
             yield instance.workflow_result
     except ChildWorkflowFailedError as err:
         if isinstance(err.cause, RuntimeError):
             return_(2)
     return_(1)
Exemple #15
0
 def execute(self):
     # lots of activities to exercise edge case handling
     self.activities_client.heartbeating_activity(5)
     self.activities_client.sum(1, 0)
     self.activities_client.sum(2, 0)
     yield self.activities_client.sum(3, 0)
     yield self.activities_client.sum(4, 0)
     yield self.activities_client.heartbeating_activity(5)
     return_(True)
Exemple #16
0
 def execute(self, child_tasklist):
     try:
         with workflow_options(task_list=child_tasklist):
             instance = yield RaisingChildWorkflow.execute()
             yield instance.workflow_result
     except ChildWorkflowFailedError as err:
         if isinstance(err.cause, RuntimeError):
             return_(2)
     return_(1)
 def execute(self):
     # lots of activities to exercise edge case handling
     self.activities_client.heartbeating_activity(5)
     self.activities_client.sum(1, 0)
     self.activities_client.sum(2, 0)
     yield self.activities_client.sum(3, 0)
     yield self.activities_client.sum(4, 0)
     yield self.activities_client.heartbeating_activity(5)
     return_(True)
Exemple #18
0
    def execute(self):
        self._wait_for_signal = Future()
        result = []
        while True:
            signal_result = yield self._wait_for_signal
            if not signal_result:
                break
            result.append(signal_result)
            # reset the future
            self._wait_for_signal = Future()

        return_(result)
    def execute(self):
        self._wait_for_signal = Future()
        result = []
        while True:
            signal_result = yield self._wait_for_signal
            if not signal_result:
                break
            result.append(signal_result)
            # reset the future
            self._wait_for_signal = Future()

        return_(result)
                def do_try_except():
                    arg_sum = 0
                    try:
                        arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                        yield BunchOfActivities.throw()
                    except ActivityTaskFailedError as err:
                        if isinstance(err.cause, ValueError) \
                           and str(err.cause) == 'Hello-Error':

                            if err.event_id != 13 or err.activity_id != '2':
                                raise RuntimeError("Test Failed")
                            arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                    yield workflow_time.sleep(1)
                    return_(arg_sum)
Exemple #21
0
                def do_try_except():
                    arg_sum = 0
                    try:
                        arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                        yield BunchOfActivities.throw()
                    except ActivityTaskFailedError as err:
                        if isinstance(err.cause, ValueError) \
                           and str(err.cause) == 'Hello-Error':

                            if err.event_id != 13 or err.activity_id != '2':
                                raise RuntimeError("Test Failed")
                            arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                    yield workflow_time.sleep(1)
                    return_(arg_sum)
Exemple #22
0
            def execute(self, arg1, arg2):
                @async
                def do_try_except():
                    arg_sum = 0
                    try:
                        arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                        yield BunchOfActivities.throw()
                    except ActivityTaskFailedError as err:
                        if isinstance(err.cause, ValueError) \
                           and str(err.cause) == 'Hello-Error':

                            if err.event_id != 13 or err.activity_id != '2':
                                raise RuntimeError("Test Failed")
                            arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                    finally:
                        arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                        return_(arg_sum)

                result = yield do_try_except()
                return_(result)
            def execute(self, arg1, arg2):
                @coroutine
                def do_try_except():
                    arg_sum = 0
                    try:
                        arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                        yield BunchOfActivities.throw()
                    except ActivityTaskFailedError as err:
                        if isinstance(err.cause, ValueError) \
                           and str(err.cause) == 'Hello-Error':

                            if err.event_id != 13 or err.activity_id != '2':
                                raise RuntimeError("Test Failed")
                            arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                    finally:
                        arg_sum += yield BunchOfActivities.sum(arg1, arg2)
                        return_(arg_sum)

                result = yield do_try_except()
                return_(result)
Exemple #24
0
 def execute(self, arg1, arg2):
     arg_sum = yield BunchOfActivities.sum(arg1, arg2)
     return_(arg_sum)
Exemple #25
0
 def execute(self, arg1):
     self.workflow_state = "Workflow Started"
     return_(arg1)
 def execute(self):
     raise CancelledError()
     return_(True)
 def execute(self):
     self.activities_client.heartbeating_activity(5)
     yield workflow_time.sleep(1)
     self.cancel()
     return_(True)
Exemple #28
0
 def execute(self, arg1, arg2):
     arg_sum = yield self.activities_client.sum(arg1, arg2)
     return_(arg_sum)
 def execute(self, template):
     (x, y) = yield ManualActivities.perform_task(template=template)
     arg_sum = yield BunchOfActivities.sum(x, y)
     return_(arg_sum)
Exemple #30
0
 def execute(self, arg1, arg2):
     instance = yield ChildWorkflow.execute(arg1, arg2)
     arg_sum = yield instance.workflow_result
     return_(arg_sum)
 def sync_method(self, x, y):
     return_(x+y)
 def execute(self):
     arg_sum = yield BunchOfActivities.sleep_activity(10)
     return_(arg_sum)
 def execute(self):
     activity_future = self.activities_client.wrong_tasklist_activity()
     yield workflow_time.sleep(2)
     yield activity_future.cancel()
     yield activity_future
     return_(False)
Exemple #34
0
 def execute(self, arg1, arg2):
     # create an activity call dynamically
     sum = flow_types.ActivityType('1.1',
                                   name='BunchOfActivities.sum')
     arg_sum = yield sum(arg1, arg2)
     return_(arg_sum)
Exemple #35
0
 def execute(self, arg1):
     return_(arg1)
Exemple #36
0
 def execute(self, arg1, arg2):
     mytime = workflow_time.time()
     yield BunchOfActivities.sum(arg1, arg2)
     return_([mytime, workflow_time.time()])
 def execute(self, template):
     result = yield ManualActivities.perform_task(template=template)
     return_(result)
 def async_method(self, x, y):
     result = yield BunchOfActivities.sum(x, y)
     return_(result)
 def execute(self, template):
     (x, y) = yield ManualActivities.perform_task(template=template)
     arg_sum = yield BunchOfActivities.sum(x, y)
     return_(arg_sum)
 def execute(self, arg1, arg2):
     arg_sum = yield self.activities_client.sum(arg1, arg2)
     return_(arg_sum)
 def sync_method(self, x, y):
     return_(x+y)
Exemple #42
0
 def execute(self, arg1, arg2, priority):
     with workflow_options(task_priority=priority):
         instance = yield ChildWorkflow.execute(arg1, arg2)
     arg_sum = yield instance.workflow_result
     return_(arg_sum)
 def execute(self):
     yield workflow_time.sleep(4)
     return_(self.msg)
 def execute(self):
     yield self.activities_client.sleep_activity(30)
     return_(True)
 def execute(self):
     activity_future = self.activities_client.heartbeating_activity(10)
     yield workflow_time.sleep(2)
     yield activity_future.cancel()
     yield activity_future
     return_(False)
 def async_method(self, x, y):
     result = yield BunchOfActivities.sum(x, y)
     return_(result)
 def execute(self):
     activity_future = self.activities_client.heartbeating_activity(5)
     yield workflow_time.sleep(2)
     activity_future._activity_id = '100'  # set invalid ID
     yield activity_future.cancel()
     return_(False)
 def execute(self, template):
     result = yield ManualActivities.perform_task(template=template)
     return_(result)
 def execute(self, details=None):
     self.cancel(details)
     return_(True)
Exemple #50
0
 def execute(self, arg1, arg2):
     sum_future = BunchOfActivities.sum(arg1, arg2)
     mul_future = BunchOfActivities.mul(arg1, arg2)
     result = yield sum_future, mul_future
     return_(result)
Exemple #51
0
 def execute(self, arg1, arg2):
     arg_sum = yield BunchOfActivities.sum(arg1, arg2)
     arg_mul = yield BunchOfActivities.mul(arg1, arg2)
     return_((arg_sum, arg_mul))
Exemple #52
0
 def execute(self, arg1, arg2):
     sleep1_future = SleepingActivities.sleep(arg1)
     sleep2_future = SleepingActivities.sleep(arg2)
     result = yield sleep1_future | sleep2_future
     return_(result)
 def execute(self, target_wf_id, target_run_id):
     external_wf = WorkflowDefinition(WorkflowExecution(target_wf_id, target_run_id))
     yield external_wf.cancel()
     return_('pass')
Exemple #54
0
 def execute(self, repeat, arg1):
     for i in range(repeat):
         yield BunchOfActivities.sum(i, arg1)
     return_(repeat)
Exemple #55
0
 def execute(self, arg1, arg2):
     with activity_options(start_to_close_timeout=66):
         arg_sum = yield BunchOfActivities.sum(arg1, arg2)
     return_(arg_sum)
 def execute(self, arg1):
     self.workflow_state = "Workflow Started"
     return_(arg1)
 def execute(self):
     activity_future = self.activities_client.heartbeating_activity(2)
     yield activity_future.cancel()
     yield activity_future
     return_(False)
Exemple #58
0
 def execute(self, arg1, arg2):
     yield workflow_time.sleep(2)
     arg_sum = yield self.activities_client.sum(arg1, arg2)
     return_(arg_sum)
Exemple #59
0
    def cancellation_handler(self):
        """Override this to take cleanup actions before workflow execution cancels.

        """
        return_(None)
Exemple #60
0
 def execute(self, arg1, arg2):
     arg_sum = yield OneActivityCustomTaskList.sum(arg1, arg2)
     return_(arg_sum)