[ARVADOS] updated: b6830de0764854345e2b746449ca45dacee40d82

git at public.curoverse.com git at public.curoverse.com
Tue Nov 24 16:06:49 EST 2015


Summary of changes:
 services/api/lib/crunch_dispatch.rb            | 3 ++-
 services/api/test/unit/crunch_dispatch_test.rb | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

       via  b6830de0764854345e2b746449ca45dacee40d82 (commit)
      from  e525509a79b62da5ea51697ba54d5a50e32d9144 (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 b6830de0764854345e2b746449ca45dacee40d82
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Nov 24 16:16:13 2015 -0500

    7676: Improve comments.

diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb
index 15491ad..bd1591d 100644
--- a/services/api/lib/crunch_dispatch.rb
+++ b/services/api/lib/crunch_dispatch.rb
@@ -160,7 +160,8 @@ class CrunchDispatch
       # Prefer nodes with no price, then cheap nodes, then expensive nodes
       node.properties['cloud_node']['price'].to_f rescue 0
     end.each do |node|
-      if need_procs.select { |node_test| not node_test.call(node) }.any?
+      if need_procs.select { |need_proc| not need_proc.call(node) }.any?
+        # At least one runtime constraint is not satisfied by this node
         next
       end
       usable_nodes << node
diff --git a/services/api/test/unit/crunch_dispatch_test.rb b/services/api/test/unit/crunch_dispatch_test.rb
index 78a7550..b33b186 100644
--- a/services/api/test/unit/crunch_dispatch_test.rb
+++ b/services/api/test/unit/crunch_dispatch_test.rb
@@ -3,7 +3,10 @@ require 'crunch_dispatch'
 class CrunchDispatchTest < ActiveSupport::TestCase
   test 'choose cheaper nodes first' do
     act_as_system_user do
+      # Replace test fixtures with a set suitable for testing dispatch
       Node.destroy_all
+
+      # Idle nodes with different prices
       [['compute1', 3.20, 32],
        ['compute2', 1.60, 16],
        ['compute3', 0.80, 8]].each do |hostname, price, cores|
@@ -20,6 +23,7 @@ class CrunchDispatchTest < ActiveSupport::TestCase
                        'total_scratch_mb' => cores*10000,
                      })
       end
+
       # Node with no price information
       Node.create!(hostname: 'compute4',
                    info: {
@@ -30,6 +34,7 @@ class CrunchDispatchTest < ActiveSupport::TestCase
                      'total_ram_mb' => 8192,
                      'total_scratch_mb' => 80000,
                    })
+
       # Cheap but busy node
       Node.create!(hostname: 'compute5',
                    info: {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list