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

周期任务的执行人改为周期更新人 #7368

Closed
1 task
ecoli666 opened this issue Feb 28, 2024 · 1 comment · Fixed by #7400
Closed
1 task

周期任务的执行人改为周期更新人 #7368

ecoli666 opened this issue Feb 28, 2024 · 1 comment · Fixed by #7400
Assignees

Comments

@ecoli666
Copy link
Collaborator

关键信息

  • bk-sops 版本:

问题描述

周期任务目前的执行人是绑死周期任务的创建者。当创建者发生角色异动时,这里将会有问题。
周期任务的通知遵循流程的通知配置,依旧发给了周期创建者,不符合预期。

image

image

优化

周期任务的执行人改为周期任务的更新人

@lTimej
Copy link
Collaborator

lTimej commented Mar 20, 2024

问题:

周期任务之前的执行人是绑死周期任务的创建者,目前需要优化将周期任务得执行人改为周期任务得更新人,但是对于pipeline引擎层没有editor这个概念

方案:

在修改周期任务的时候,同时把PipelinePeriodicTask这张表的creator修改为周期任务的editor,因为周期任务执行pipelineinstance将PipelinePeriodicTask的creator跟creator绑定
def partial_update(self, request, *args, **kwargs):
instance = self.get_object()
... ...
with transaction.atomic():
instance.editor = request.user.username
instance.save(update_fields=["editor", "edit_time"])
instance.task.creator = request.user.username
instance.task.save()

影响:

这种修改会出现一种问题,a用户创建两个周期任务,上线后b用户修改了任务1没有修改任务2,结果任务1执行人是吧b,任务2执行人a,可能会让用户感觉混乱
任务1. creator: a, updator: b, excutor: b
任务2. creator: a, updator: "",excutor: a``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants