Skip to content

Commit

Permalink
fix(backend): 任务创建失败发送通知 TencentBlueKing#8582
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Dec 12, 2024
1 parent 5639fcb commit 3190702
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion dbm-ui/backend/ticket/flow_manager/inner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@
from backend.flow.models import FlowTree
from backend.ticket import constants
from backend.ticket.builders.common.base import fetch_cluster_ids
from backend.ticket.constants import BAMBOO_STATE__TICKET_STATE_MAP, FlowCallbackType, TicketType
from backend.ticket.constants import (
BAMBOO_STATE__TICKET_STATE_MAP,
FlowCallbackType,
FlowMsgType,
TicketFlowStatus,
TicketType,
)
from backend.ticket.flow_manager.base import BaseTicketFlow
from backend.ticket.models import Flow
from backend.utils.basic import generate_root_id
Expand Down Expand Up @@ -155,6 +161,18 @@ def run(self) -> None:
)
# 处理互斥异常和非预期的异常
self.run_error_status_handler(err)
# 发送创建任务失败通知
from backend.ticket.tasks.ticket_tasks import send_msg_for_flow

send_msg_for_flow.apply_async(
kwargs={
"flow_id": self.flow_obj.id,
"flow_msg_type": FlowMsgType.DONE.value,
"flow_status": TicketFlowStatus.get_choice_label(self.flow_obj.status),
"processor": self.ticket.creator,
"receiver": self.ticket.creator,
}
)
return
else:
# 记录inner flow的集群动作和实例动作
Expand Down

0 comments on commit 3190702

Please sign in to comment.