def _on_interaction_cancelled(self, interaction: Interaction, finishing_type: FinishingType, cancel_reason_msg: str, ignore_must_run: bool = False, **__) -> None: if finishing_type is None: return None try: CommonEventRegistry().dispatch( S4CLInteractionCancelledEvent(interaction, finishing_type, cancel_reason_msg, ignore_must_run=ignore_must_run, **__)) except Exception as ex: self.log.error( 'Error occurred while running _on_interaction_cancelled for interaction {} with short name \'{}\' and display name {}. Finishing Type: {}, Cancel Reason: {}, Ignore Must Run: {}, Kwargs: {}' .format( pformat(interaction), CommonInteractionUtils.get_interaction_short_name( interaction), CommonInteractionUtils.get_interaction_display_name( interaction), finishing_type, cancel_reason_msg, ignore_must_run, __), exception=ex) return None
def _on_interaction_outcome(self, interaction: Interaction, outcome: InteractionOutcome, result: OutcomeResult) -> None: if interaction.sim is None: return None try: CommonEventRegistry().dispatch( S4CLInteractionOutcomeEvent(interaction, outcome, result)) except Exception as ex: self.log.error( 'Error occurred while running _on_interaction_outcome for interaction {} with short name \'{}\' and display name {}. Outcome: {}, Result: {}' .format( pformat(interaction), CommonInteractionUtils.get_interaction_short_name( interaction), CommonInteractionUtils.get_interaction_display_name( interaction), outcome, result), exception=ex) return None
def _on_interaction_run(self, interaction_queue: InteractionQueue, timeline: Timeline, interaction: Interaction, run_result: bool, *_, **__) -> None: if interaction is None or interaction.sim is None: return None try: CommonEventRegistry().dispatch( S4CLInteractionRunEvent(interaction, interaction_queue, run_result)) except Exception as ex: self.log.error( 'Error occurred while running _on_interaction_run for interaction {} with short name \'{}\' and display name {}. Original Run Result: {}, Args: {}, Kwargs: {}' .format( pformat(interaction), CommonInteractionUtils.get_interaction_short_name( interaction), CommonInteractionUtils.get_interaction_display_name( interaction), str(run_result), _, __), exception=ex) return None
def _on_interaction_pre_run(self, interaction_queue: InteractionQueue, timeline: Timeline, interaction: Interaction, *_, **__) -> Union[bool, None]: if interaction is None or interaction.sim is None: return None try: if not CommonEventRegistry().dispatch( S4CLInteractionPreRunEvent(interaction, interaction_queue, timeline)): return False except Exception as ex: self.log.error( 'Error occurred while running _on_interaction_pre_run for interaction {} with short name \'{}\' and display name {}. Args: {}, Kwargs: {}' .format( pformat(interaction), CommonInteractionUtils.get_interaction_short_name( interaction), CommonInteractionUtils.get_interaction_display_name( interaction), _, __), exception=ex) return None
def _on_interaction_post_queued(self, interaction_queue: InteractionQueue, interaction: Interaction, queue_result: TestResult, *_, **__) -> None: if interaction is None or interaction.sim is None: return None try: CommonEventRegistry().dispatch( S4CLInteractionPostQueuedEvent(interaction, interaction_queue, queue_result)) except Exception as ex: self.log.error( 'Error occurred while running _on_interaction_post_queued for interaction {} with short name \'{}\' and display name {}. Queue Result: {}, Args: {}, Kwargs: {}' .format( pformat(interaction), CommonInteractionUtils.get_interaction_short_name( interaction), CommonInteractionUtils.get_interaction_display_name( interaction), queue_result, _, __), exception=ex) return None
def _on_interaction_queued(self, interaction_queue: InteractionQueue, interaction: Interaction, *_, **__) -> Union[TestResult, None]: if interaction is None or interaction.sim is None: return None try: if not CommonEventRegistry().dispatch( S4CLInteractionQueuedEvent(interaction, interaction_queue)): return TestResult( False, 'Interaction \'{}\' Failed to Queue'.format( pformat(interaction))) except Exception as ex: self.log.error( 'Error occurred while running _on_interaction_queued for interaction {} with short name \'{}\' and display name {}. Args: {}, Kwargs: {}' .format( pformat(interaction), CommonInteractionUtils.get_interaction_short_name( interaction), CommonInteractionUtils.get_interaction_display_name( interaction), _, __), exception=ex) return None