12840: Differentiate "Cancelled" from "Failed" pipeline instances.
[arvados.git] / services / api / app / models / node.rb
index e1c1e649143c3f142acb24c7e9525c5247d4800d..bf1b636c52836bd54c75373c29fde51897e4b766 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'tempfile'
 
 class Node < ArvadosModel
@@ -139,6 +143,9 @@ class Node < ArvadosModel
   protected
 
   def self.available_slot_number
+    # Join the sequence 1..max with the nodes table. Return the first
+    # (i.e., smallest) value that doesn't match the slot_number of any
+    # existing node.
     connection.exec_query('SELECT n FROM generate_series(1, $1) AS slot(n)
                           LEFT JOIN nodes ON n=slot_number
                           WHERE slot_number IS NULL