[ARVADOS] updated: 3e3df723e221dadf2512ac4935c1f6f0fe8f7834

git at public.curoverse.com git at public.curoverse.com
Tue Sep 23 10:37:37 EDT 2014


Summary of changes:
 services/api/app/models/node.rb      |  1 +
 services/api/test/fixtures/nodes.yml | 33 +++++++++++++++++++++++++--------
 services/api/test/unit/node_test.rb  |  6 ++++++
 3 files changed, 32 insertions(+), 8 deletions(-)

       via  3e3df723e221dadf2512ac4935c1f6f0fe8f7834 (commit)
      from  1fc256cee80eef7aa2178789f23a729ba9f27b79 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 3e3df723e221dadf2512ac4935c1f6f0fe8f7834
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 23 10:36:36 2014 -0400

    Report crunch_worker_state=down for nodes not occupying a worker slot. refs #3605

diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index 45fd3b1..119a0ed 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -34,6 +34,7 @@ class Node < ArvadosModel
   end
 
   def crunch_worker_state
+    return 'down' if slot_number.nil?
     case self.info.andand['slurm_state']
     when 'alloc', 'comp'
       'busy'
diff --git a/services/api/test/fixtures/nodes.yml b/services/api/test/fixtures/nodes.yml
index 92e78da..f282e7e 100644
--- a/services/api/test/fixtures/nodes.yml
+++ b/services/api/test/fixtures/nodes.yml
@@ -1,35 +1,52 @@
 busy:
   uuid: zzzzz-7ekkf-53y36l1lu5ijveb
-  owner_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  owner_uuid: zzzzz-tpzed-000000000000000
   hostname: compute0
+  slot_number: 0
   domain: ""
   ip_address: 172.17.2.172
   last_ping_at: <%= 1.minute.ago.to_s(:db) %>
   first_ping_at: <%= 23.hour.ago.to_s(:db) %>
   info:
-    :ping_secret: "48dpm3b8ijyj3jkr2yczxw0844dqd2752bhll7klodvgz9bg80"
-    :slurm_state: "alloc"
+    ping_secret: "48dpm3b8ijyj3jkr2yczxw0844dqd2752bhll7klodvgz9bg80"
+    slurm_state: "alloc"
 
 down:
   uuid: zzzzz-7ekkf-2vbompg3ecc6e2s
-  owner_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  owner_uuid: zzzzz-tpzed-000000000000000
   hostname: compute1
+  slot_number: 1
   domain: ""
   ip_address: 172.17.2.173
   last_ping_at: <%= 1.hour.ago.to_s(:db) %>
   first_ping_at: <%= 23.hour.ago.to_s(:db) %>
   info:
-    :ping_secret: "2k3i71depad36ugwmlgzilbi4e8n0illb2r8l4efg9mzkb3a1k"
+    ping_secret: "2k3i71depad36ugwmlgzilbi4e8n0illb2r8l4efg9mzkb3a1k"
 
 idle:
   uuid: zzzzz-7ekkf-2z3mc76g2q73aio
-  owner_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  owner_uuid: zzzzz-tpzed-000000000000000
   hostname: compute2
+  slot_number: 2
   domain: ""
   ip_address: 172.17.2.174
   last_ping_at: <%= 2.minute.ago.to_s(:db) %>
   first_ping_at: <%= 23.hour.ago.to_s(:db) %>
   info:
-    :ping_secret: "69udawxvn3zzj45hs8bumvndricrha4lcpi23pd69e44soanc0"
-    :slurm_state: "idle"
+    ping_secret: "69udawxvn3zzj45hs8bumvndricrha4lcpi23pd69e44soanc0"
+    slurm_state: "idle"
+    total_cpu_cores: 16
+
+was_idle_now_down:
+  uuid: zzzzz-7ekkf-xuzpkdasl0uzwyz
+  owner_uuid: zzzzz-tpzed-000000000000000
+  hostname: compute3
+  slot_number: ~
+  domain: ""
+  ip_address: 172.17.2.173
+  last_ping_at: <%= 1.hour.ago.to_s(:db) %>
+  first_ping_at: <%= 23.hour.ago.to_s(:db) %>
+  info:
+    ping_secret: "1bd1yi0x4lb5q4gzqqtrnq30oyj08r8dtdimmanbqw49z1anz2"
+    slurm_state: "idle"
     total_cpu_cores: 16
diff --git a/services/api/test/unit/node_test.rb b/services/api/test/unit/node_test.rb
index 8e1233c..37e95db 100644
--- a/services/api/test/unit/node_test.rb
+++ b/services/api/test/unit/node_test.rb
@@ -20,4 +20,10 @@ class NodeTest < ActiveSupport::TestCase
     refute_includes(node.properties, 'total_cpu_cores')
     assert_equal(256, node.properties['total_ram_mb'])
   end
+
+  test "worker state is down for node with no slot" do
+    node = nodes(:was_idle_now_down)
+    assert_nil node.slot_number, "fixture is not what I expected"
+    assert_equal 'down', node.crunch_worker_state, "wrong worker state"
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list