[ARVADOS] created: 23c3347fe9779c3826179285de86e8540d46d749
git at public.curoverse.com
git at public.curoverse.com
Thu Nov 19 13:33:03 EST 2015
at 23c3347fe9779c3826179285de86e8540d46d749 (commit)
commit 23c3347fe9779c3826179285de86e8540d46d749
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Nov 19 13:32:44 2015 -0500
5353: Explicitly set size field on node objects returned by list_nodes on AWS and Azure.
diff --git a/services/nodemanager/arvnodeman/computenode/driver/__init__.py b/services/nodemanager/arvnodeman/computenode/driver/__init__.py
index 14e804f..06b532a 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/__init__.py
@@ -53,6 +53,8 @@ class BaseComputeNodeDriver(object):
if new_pair is not None:
self.create_kwargs[new_pair[0]] = new_pair[1]
+ self.sizes = {sz.id: sz for sz in self.real.list_sizes()}
+
def _init_ping_host(self, ping_host):
self.ping_host = ping_host
diff --git a/services/nodemanager/arvnodeman/computenode/driver/azure.py b/services/nodemanager/arvnodeman/computenode/driver/azure.py
index b1ec5e6..cfa529b 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/azure.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/azure.py
@@ -88,6 +88,14 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
# of failure that the Azure libcloud driver doesn't know how to interpret.
return (cloud_node.state in (cloud_types.NodeState.ERROR, cloud_types.NodeState.UNKNOWN))
+ def list_nodes(self):
+ # Need to populate Node.size
+ nodes = super(ComputeNodeDriver, self).list_nodes()
+ for n in nodes:
+ if not n.size:
+ n.size = self.sizes[n.extra["properties"]["hardwareProfile"]["vmSize"]]
+ return nodes
+
@classmethod
def node_fqdn(cls, node):
return node.extra["tags"].get("hostname")
diff --git a/services/nodemanager/arvnodeman/computenode/driver/ec2.py b/services/nodemanager/arvnodeman/computenode/driver/ec2.py
index 6afe316..c0a72b7 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/ec2.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/ec2.py
@@ -75,6 +75,14 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
self.real.ex_create_tags(cloud_node,
{'Name': arvados_node_fqdn(arvados_node)})
+ def list_nodes(self):
+ # Need to populate Node.size
+ nodes = super(ComputeNodeDriver, self).list_nodes()
+ for n in nodes:
+ if not n.size:
+ n.size = self.sizes[n.extra["instance_type"]]
+ return nodes
+
@classmethod
def node_fqdn(cls, node):
return node.name
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list