1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class JobTask < ArvadosModel
8 include CommonApiTemplate
9 serialize :parameters, Hash
10 before_create :set_default_qsequence
11 after_update :delete_created_job_tasks_if_failed
13 api_accessible :user, extend: :common do |t|
15 t.add :created_by_job_task_uuid
28 def delete_created_job_tasks_if_failed
29 if self.success == false and self.success != self.success_was
30 JobTask.delete_all ['created_by_job_task_uuid = ?', self.uuid]
34 def set_default_qsequence
35 self.qsequence ||= self.class.connection.
36 select_value("SELECT nextval('job_tasks_qsequence_seq')")