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

任务执行前需要校验任务是否已删除 #7307

Open
ecoli666 opened this issue Jan 18, 2024 · 1 comment · Fixed by #7344
Open

任务执行前需要校验任务是否已删除 #7307

ecoli666 opened this issue Jan 18, 2024 · 1 comment · Fixed by #7344
Assignees

Comments

@ecoli666
Copy link
Collaborator

问题描述

用户 a 新建了任务,开着任务窗口但未执行
用户 b 删除了任务
用户 a 点执行 ,执行成功

@lTimej
Copy link
Collaborator

lTimej commented Jan 25, 2024

def task_action(self, action, username):
      # self: 任务对象
      # 在这里增加一个判断,判断任务是否被删除
      if self.is_deleted: # 为True,终止执行
          message = _(f"任务操作失败: 任务[ID: {self.id}]已被删除")
          logger.error(message)
          return {"result": False, "message": message, "code": err_code.INVALID_OPERATION.code}
      ........ 
      # 任务命令分发
      dispatcher = TaskCommandDispatcher(
          engine_ver=self.engine_ver,
          taskflow_id=self.id,
          pipeline_instance=self.pipeline_instance,
          project_id=self.project_id,
          queue=self._get_task_celery_queue(self.engine_ver),
      )
      ......

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