[ARVADOS] updated: 82a3d53af36a8374a4a1f28a19c69feabe8ca217
git at public.curoverse.com
git at public.curoverse.com
Wed Jun 17 18:38:45 EDT 2015
Summary of changes:
sdk/python/arvados/api.py | 5 +-
services/api/app/models/node.rb | 31 ++++--------
services/api/config/application.default.yml | 4 +-
services/api/test/unit/node_test.rb | 25 ++++------
services/datamanager/keep/keep.go | 75 ++++++++++++++++++-----------
services/keepstore/handler_test.go | 8 +--
services/keepstore/handlers.go | 63 +++++-------------------
services/keepstore/perms.go | 23 ++++++---
services/keepstore/perms_test.go | 24 ++++-----
9 files changed, 116 insertions(+), 142 deletions(-)
via 82a3d53af36a8374a4a1f28a19c69feabe8ca217 (commit)
via ac7939b70866c8ed8bcdd9f0854c6c845534ba78 (commit)
via 4d0e87db2bef1f30634d28338e89227b985e6485 (commit)
via 6f652a6a75b6c17e55cf62a3e0c047595e3aa035 (commit)
via a4d63932d669acd5011a7fa5afcbeec513acfe2c (commit)
via 7c0924d91aef5da1f69bd5f88b61880915afae4a (commit)
via 37ffea7224fa4af8af63de2882e4cf9592870822 (commit)
from 451a6d3590ed7c049ad6ce24f8f6c01685d7d3d3 (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 82a3d53af36a8374a4a1f28a19c69feabe8ca217
Author: radhika <radhika at curoverse.com>
Date: Wed Jun 17 18:34:17 2015 -0400
6156: use only sprintf formatting for node slot_number config.
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index 0ec9136..abb46fd 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -213,32 +213,21 @@ class Node < ArvadosModel
return nil if !config
- begin
- if config.include?('%')
- sprintf(config, {:slot_number => slot_number})
- else
- eval('"' + config + '"')
- end
- rescue => e
- logger.error "Eror generating hostname: #{e.message}"
- return nil
- end
+ sprintf(config, {:slot_number => slot_number})
end
# At startup, make sure all DNS entries exist. Otherwise, slurmctld
# will refuse to start.
- if Rails.configuration.dns_server_conf_dir and Rails.configuration.dns_server_conf_template
+ if Rails.configuration.dns_server_conf_dir and Rails.configuration.dns_server_conf_template and Rails.configuration.assign_node_hostname
(0..Rails.configuration.max_compute_nodes-1).each do |slot_number|
- if Rails.configuration.assign_node_hostname
- hostname = hostname_for_slot(slot_number)
- hostfile = File.join Rails.configuration.dns_server_conf_dir, "#{hostname}.conf"
- if !File.exists? hostfile
- n = Node.where(:slot_number => slot_number).first
- if n.nil? or n.ip_address.nil?
- dns_server_update(hostname, '127.40.4.0')
- else
- dns_server_update(hostname, n.ip_address)
- end
+ hostname = hostname_for_slot(slot_number)
+ hostfile = File.join Rails.configuration.dns_server_conf_dir, "#{hostname}.conf"
+ if !File.exists? hostfile
+ n = Node.where(:slot_number => slot_number).first
+ if n.nil? or n.ip_address.nil?
+ dns_server_update(hostname, '127.40.4.0')
+ else
+ dns_server_update(hostname, n.ip_address)
end
end
end
diff --git a/services/api/config/application.default.yml b/services/api/config/application.default.yml
index 8f3207a..9b758e6 100644
--- a/services/api/config/application.default.yml
+++ b/services/api/config/application.default.yml
@@ -342,8 +342,6 @@ common:
# with your DNS records and your /etc/slurm-llnl/slurm.conf files.
#
# Example for compute0000, compute0001, ....:
- # assign_node_hostname: compute#{slot_number.to_s.rjust(4, "0")}
- # or
# assign_node_hostname: compute%<slot_number>04d
# (See http://ruby-doc.org/core-2.2.2/Kernel.html#method-i-format for more.)
- assign_node_hostname: compute#{slot_number}
+ assign_node_hostname: compute%<slot_number>d
diff --git a/services/api/test/unit/node_test.rb b/services/api/test/unit/node_test.rb
index 96d31a8..ef50036 100644
--- a/services/api/test/unit/node_test.rb
+++ b/services/api/test/unit/node_test.rb
@@ -90,17 +90,12 @@ class NodeTest < ActiveSupport::TestCase
assert_nil node.hostname
end
- [
- 'compute#{slot_number.to_s.rjust(4, "0")}',
- 'compute%<slot_number>04d',
- ].each do |config|
- test "ping new node with zero padding config #{config}" do
- Rails.configuration.assign_node_hostname = config
- node = ping_node(:new_with_no_hostname, {})
- slot_number = node.slot_number
- refute_nil slot_number
- assert_equal("compute000#{slot_number}", node.hostname)
- end
+ test "ping new node with zero padding config" do
+ Rails.configuration.assign_node_hostname = 'compute%<slot_number>04d'
+ node = ping_node(:new_with_no_hostname, {})
+ slot_number = node.slot_number
+ refute_nil slot_number
+ assert_equal("compute000#{slot_number}", node.hostname)
end
test "ping node with hostname and config and expect hostname unchanged" do
@@ -116,7 +111,7 @@ class NodeTest < ActiveSupport::TestCase
assert_equal("custom1", node.hostname)
end
- # Ping two nodes: one with no hostname and the other with a hostname.
+ # Ping two nodes: one without a hostname and the other with a hostname.
# Verify that the first one gets a hostname and second one is unchanged.
test "ping two nodes one with no hostname and one with hostname and check hostnames" do
# ping node with no hostname and expect it set with config format
@@ -133,8 +128,8 @@ class NodeTest < ActiveSupport::TestCase
test "ping node with no hostname and malformed config and expect nil for hostname" do
Rails.configuration.assign_node_hostname = 'compute%<slot_number>04' # should end with "04d"
- node = ping_node(:new_with_no_hostname, {})
- refute_nil node.slot_number
- assert_equal(nil, node.hostname)
+ assert_raise ArgumentError do
+ ping_node(:new_with_no_hostname, {})
+ end
end
end
commit ac7939b70866c8ed8bcdd9f0854c6c845534ba78
Merge: 451a6d3 4d0e87d
Author: radhika <radhika at curoverse.com>
Date: Wed Jun 17 17:36:58 2015 -0400
Merge branch 'master' into 6156-hostnames-in-nodes
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list