def add_completed_event(context_builder: ContextBuilder, id_: int, name: str,
                        result):
    context_builder.add_task_scheduled_event(name=name, id_=id_)
    context_builder.add_orchestrator_completed_event()
    context_builder.add_orchestrator_started_event()
    context_builder.add_task_completed_event(id_=id_,
                                             result=json.dumps(result))
def add_hello_failed_events(
        context_builder: ContextBuilder, id_: int, reason: str, details: str):
    context_builder.add_task_scheduled_event(name='Hello', id_=id_)
    context_builder.add_orchestrator_completed_event()
    context_builder.add_orchestrator_started_event()
    context_builder.add_task_failed_event(
        id_=id_, reason=reason, details=details)
Example #3
0
def add_failed_http_events(context_builder: ContextBuilder, id_: int,
                           reason: str, details: str):
    context_builder.add_task_scheduled_event(name=HTTP_ACTION_NAME, id_=id_)
    context_builder.add_orchestrator_completed_event()
    context_builder.add_orchestrator_started_event()
    context_builder.add_task_failed_event(id_=id_,
                                          reason=reason,
                                          details=details)
Example #4
0
    def _schedule_events(
            context: ContextBuilder,
            id_counter: int) -> Tuple[ContextBuilder, int, List[int]]:
        """Add scheduled events to the context.

        Parameters
        ----------
        context: ContextBuilder
            Orchestration context mock, to which we'll add the event completion events
        id_counter: int
            The current event counter

        Returns
        -------
        Tuple[ContextBuilder, int, List[int]]:
            The updated context, the updated counter, a list of event IDs for each scheduled event
        """
        scheduled_ids: List[int] = []
        for id_ in range(num_activities):
            scheduled_ids.append(id_)
            context.add_task_scheduled_event(name='Hello', id_=id_)
            id_counter += 1
        return context, id_counter, scheduled_ids
Example #5
0
def add_completed_http_events(context_builder: ContextBuilder, id_: int,
                              result: str):
    context_builder.add_task_scheduled_event(name=HTTP_ACTION_NAME, id_=id_)
    context_builder.add_orchestrator_completed_event()
    context_builder.add_orchestrator_started_event()
    context_builder.add_task_completed_event(id_=id_, result=result)
Example #6
0
def add_hello_completed_events(context_builder: ContextBuilder, id_: int,
                               result: str):
    context_builder.add_task_scheduled_event(name='Hello', id_=id_)
    context_builder.add_orchestrator_completed_event()
    context_builder.add_orchestrator_started_event()
    context_builder.add_task_completed_event(id_=id_, result=result)