Merge branch 'master' into 8654-arv-jobs-cwl-runner
[arvados.git] / services / api / app / models / job.rb
index 6c24293334f6d4cc5af371b1b2b9a0d370466530..afaae26375b6e8b1659205c439306cbb2e1d4eea 100644 (file)
@@ -78,12 +78,13 @@ class Job < ArvadosModel
   end
 
   def queue_position
-    Job::queue.each_with_index do |job, index|
-      if job[:uuid] == self.uuid
-        return index
-      end
-    end
-    nil
+    # We used to report this accurately, but the implementation made queue
+    # API requests O(n**2) for the size of the queue.  See #8800.
+    # We've soft-disabled it because it's not clear we even want this
+    # functionality: now that we have Node Manager with support for multiple
+    # node sizes, "queue position" tells you very little about when a job will
+    # run.
+    state == Queued ? 0 : nil
   end
 
   def self.running