Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

独立子任务创建是添加由父任务触发的操作记录 #7038

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gcloud/contrib/operate_record/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class OperateSource(Enum):

app = _("app 页面")
api = _("api 接口")
parent = _("父任务")

# 模版来源
project = _("项目流程")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

from gcloud.common_template.models import CommonTemplate
from gcloud.constants import NON_COMMON_TEMPLATE_TYPES, PROJECT
from gcloud.contrib.operate_record.constants import OperateSource, OperateType, RecordType
from gcloud.contrib.operate_record.signal import operate_record_signal
from gcloud.contrib.operate_record.utils import extract_extra_info
from gcloud.core.models import EngineConfig, Project
from gcloud.taskflow3.domains.auto_retry import AutoRetryNodeStrategyCreator
from gcloud.taskflow3.models import TaskCallBackRecord, TaskFlowInstance, TaskFlowRelation, TimeoutNodeConfig
Expand Down Expand Up @@ -192,10 +195,33 @@ def execute(self, data, parent_data):
pipeline_tree=task.pipeline_instance.execution_data,
)

# 记录操作流水
pipeline_constants = pipeline_instance.execution_data.get("constants")
extra_info = extract_extra_info(pipeline_constants)
operate_record_signal.send(
sender=RecordType.task.name,
operator="system",
operate_type=OperateType.create.name,
operate_source=OperateSource.parent.name,
instance_id=task.id,
project_id=task.project_id,
extra_info=extra_info,
)

task.task_action("start", parent_task.executor)
data.set_outputs("task_id", task.id)
data.set_outputs("task_url", task.url)
data.set_outputs("task_name", task.name)

# 记录操作流水
operate_record_signal.send(
sender=RecordType.task.name,
operator="system",
operate_type=OperateType.start.name,
operate_source=OperateSource.parent.name,
instance_id=task.id,
project_id=task.project_id,
)
return True

def schedule(self, data, parent_data, callback_data=None):
Expand Down
Loading