2880: Improve error reporting when crunch-dispatch updates node status.
authorBrett Smith <brett@curoverse.com>
Fri, 6 Jun 2014 16:03:54 +0000 (12:03 -0400)
committerBrett Smith <brett@curoverse.com>
Tue, 10 Jun 2014 18:11:24 +0000 (14:11 -0400)
services/api/script/crunch-dispatch.rb

index c40c62d5cfc7b05d8256ca5b4485c23fd1b835ce..11d5540881dd754e69253bc509bed8f205613fdd 100755 (executable)
@@ -88,13 +88,16 @@ class Dispatcher
             if node
               $stderr.puts "dispatch: update #{re[1]} state to #{re[2]}"
               node.info['slurm_state'] = re[2]
-              node.save
+              if not node.save
+                $stderr.puts "dispatch: failed to update #{node.uuid}: #{node.errors.messages}"
+              end
             elsif re[2] != 'down'
               $stderr.puts "dispatch: sinfo reports '#{re[1]}' is not down, but no node has that name"
             end
           end
         end
-      rescue
+      rescue => error
+        $stderr.puts "dispatch: error updating node status: #{error}"
       end
     end
   end