app/models/naf/historical_job.rb in naf-1.1.4 vs app/models/naf/historical_job.rb in naf-2.0.0

- old
+ new

@@ -28,11 +28,10 @@ :termination_signal, :state, :request_to_terminate, :marked_dead_by_machine_id, :log_level, - :tags, :machine_runner_invocation_id JOB_STALE_TIME = 1.week SYSTEM_TAGS = { startup: '$startup', @@ -57,10 +56,16 @@ class_name: "::Naf::Application" belongs_to :application_run_group_restriction, class_name: "::Naf::ApplicationRunGroupRestriction" belongs_to :machine_runner_invocation, class_name: "::Naf::MachineRunnerInvocation" + has_one :running_job, + class_name: "::Naf::RunningJob", + foreign_key: :id + has_one :queued_job, + class_name: "::Naf::QueuedJob", + foreign_key: :id # Must access instance methods job_prerequisites through helper methods so we can use partitioning sql has_many :historical_job_prerequisites, class_name: "::Naf::HistoricalJobPrerequisite", dependent: :destroy has_many :prerequisites, @@ -97,10 +102,13 @@ # *** Delegations *** #++++++++++++++++++++ delegate :application_run_group_restriction_name, to: :application_run_group_restriction delegate :script_type_name, to: :application_type + delegate :affinity_name, + :affinity_classification_name, + :affinity_short_name, to: :affinity #------------------ # *** Partition *** #++++++++++++++++++ @@ -298,37 +306,9 @@ end end def spawn application_type.spawn(self) - end - - def add_tags(tags_to_add) - tags_array = nil - if self.tags.present? - tags_array = self.tags.gsub(/[{}]/,'').split(',') - new_tags = '{' + (tags_array | tags_to_add).join(',') + '}' - else - new_tags = '{' + tags_to_add.join(',') + '}' - end - - self.tags = new_tags - self.save! - end - - def remove_tags(tags_to_remove) - if self.tags.present? - tags_array = self.tags.gsub(/[{}]/,'').split(',') - new_tags = '{' + (tags_array - tags_to_remove).join(',') + '}' - - self.tags = new_tags - self.save! - end - end - - def remove_all_tags - self.tags = '{}' - self.save! end end end