2875: add description to jobs and pipeline_instances.
[arvados.git] / services / api / app / models / job.rb
index f56b57ac7b42361a216d05f93b07278fea7e1479..32f28e3582d509930a4bdf3339659035f6d9b5d5 100644 (file)
@@ -8,6 +8,7 @@ class Job < ArvadosModel
   serialize :tasks_summary, Hash
   before_create :ensure_unique_submit_id
   after_commit :trigger_crunch_dispatch_if_cancelled, :on => :update
+  before_validation :set_priority
   validate :ensure_script_version_is_commit
   validate :find_docker_image_locator
 
@@ -28,7 +29,6 @@ class Job < ArvadosModel
     t.add :started_at
     t.add :finished_at
     t.add :output
-    t.add :output_is_persistent
     t.add :success
     t.add :running
     t.add :is_locked_by_uuid
@@ -40,7 +40,6 @@ class Job < ArvadosModel
     t.add :repository
     t.add :supplied_script_version
     t.add :docker_image_locator
-    t.add :name
     t.add :description
   end
 
@@ -75,6 +74,13 @@ class Job < ArvadosModel
     super + %w(output log)
   end
 
+  def set_priority
+    if self.priority.nil?
+      self.priority = 0
+    end
+    true
+  end
+
   def ensure_script_version_is_commit
     if self.is_locked_by_uuid and self.started_at
       # Apparently client has already decided to go for it. This is