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
12 before_create :create_disabled
13 before_update :update_disabled
15 api_accessible :user, extend: :common do |t|
17 t.add :created_by_job_task_uuid
30 def delete_created_job_tasks_if_failed
31 if self.success == false and self.success != self.success_was
32 JobTask.delete_all ['created_by_job_task_uuid = ?', self.uuid]
36 def set_default_qsequence
37 self.qsequence ||= self.class.connection.
38 select_value("SELECT nextval('job_tasks_qsequence_seq')")