+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
class PipelineInstance < ArvadosModel
include HasUuid
include KindAndEtag
before_validation :bootstrap_components
before_validation :update_state
before_validation :verify_status
+ before_validation :update_timestamps_when_state_changes
before_create :set_state_before_save
before_save :set_state_before_save
- before_save :update_timestamps_when_state_changes
+ before_create :create_disabled
+ before_update :update_disabled
api_accessible :user, extend: :common do |t|
t.add :pipeline_template_uuid
(Complete = 'Complete'),
]
+ def self.limit_index_columns_read
+ ["components"]
+ end
+
# if all components have input, the pipeline is Ready
def components_look_ready?
if !self.components || self.components.empty?
self.where("state = 'RunningOnServer'")
end
+ def cancel(cascade: false, need_transaction: true)
+ raise "No longer supported"
+ end
+
protected
def bootstrap_components
if pipeline_template and (!components or components.empty?)
end
end
- if self.state.in?(States)
- true
- else
+ if !self.state.in?(States)
errors.add :state, "'#{state.inspect} must be one of: [#{States.join ', '}]"
- false
+ throw(:abort)
end
end
when RunningOnServer, RunningOnClient
self.started_at ||= db_current_time
when Failed, Complete
- self.finished_at ||= db_current_time
+ current_time = db_current_time
+ self.started_at ||= current_time
+ self.finished_at ||= current_time
end
end
+
+ def create_disabled
+ raise "Disabled"
+ end
+
+ def update_disabled
+ raise "Disabled"
+ end
end