| 78 | |
| 79 | @CounterWithTimer(key="notifier.action.executions") |
| 80 | def process(self, execution_db): |
| 81 | execution_id = str(execution_db.id) |
| 82 | extra = {"execution": execution_db} |
| 83 | LOG.debug('Processing action execution "%s".', execution_id, extra=extra) |
| 84 | |
| 85 | # Get the corresponding liveaction record. |
| 86 | liveaction_db = LiveAction.get_by_id(execution_db.liveaction["id"]) |
| 87 | |
| 88 | if execution_db.status in LIVEACTION_COMPLETED_STATES: |
| 89 | # If the action execution is executed under an orquesta workflow, policies for the |
| 90 | # action execution will be applied by the workflow engine. A policy may affect the |
| 91 | # final state of the action execution thereby impacting the state of the workflow. |
| 92 | if not workflow_service.is_action_execution_under_workflow_context( |
| 93 | execution_db |
| 94 | ): |
| 95 | with CounterWithTimer(key="notifier.apply_post_run_policies"): |
| 96 | policy_service.apply_post_run_policies(liveaction_db) |
| 97 | |
| 98 | if liveaction_db.notify: |
| 99 | with CounterWithTimer(key="notifier.notify_trigger.post"): |
| 100 | self._post_notify_triggers( |
| 101 | liveaction_db=liveaction_db, execution_db=execution_db |
| 102 | ) |
| 103 | |
| 104 | self._post_generic_trigger( |
| 105 | liveaction_db=liveaction_db, execution_db=execution_db |
| 106 | ) |
| 107 | |
| 108 | def _get_execution_for_liveaction(self, liveaction): |
| 109 | execution = ActionExecution.get(liveaction__id=str(liveaction.id)) |