From 012a8097872c61aee30ea72cc5508a351f2f4632 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 23 Dec 2011 10:21:46 -0800 Subject: [PATCH] Flush stdout for meaningful job output. Change-Id: Ice914a121237d3224c4da578a06c1053791e722c --- slave_scripts/devstack-vm-launch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/slave_scripts/devstack-vm-launch.py b/slave_scripts/devstack-vm-launch.py index 8222eda9..1b66bc14 100755 --- a/slave_scripts/devstack-vm-launch.py +++ b/slave_scripts/devstack-vm-launch.py @@ -54,6 +54,7 @@ num_to_launch = MIN_READY_MACHINES - (len(ready_machines) + print "%s ready, %s building, need to launch %s" % (len(ready_machines), len(building_machines), num_to_launch) +sys.stdout.flush() if num_to_launch <= 0: sys.exit(0) @@ -89,6 +90,7 @@ if CLOUD_SERVERS_DRIVER == 'rackspace': print " name: %s [%s]" % (node_name, node.public_ip[0]) print " uuid: %s" % (node.uuid) print + sys.stdout.flush() # Wait for nodes # TODO: The vmdatabase is (probably) ready, but this needs reworking to @@ -101,24 +103,29 @@ if CLOUD_SERVERS_DRIVER == 'rackspace': if x['state'] == vmdatabase.BUILDING] if not building_machines: print "Finished" + sys.stdout.flush() break provider_nodes = conn.list_nodes() print "Waiting on %s machines" % len(building_machines) + sys.stdout.flush() for my_node in building_machines: if my_node['uuid'] in to_ignore: continue p_nodes = [x for x in provider_nodes if x.uuid == my_node['uuid']] if len(p_nodes) != 1: print "Incorrect number of nodes (%s) from provider matching UUID %s" % (len(p_nodes), my_node['uuid']) + sys.stdout.flush() to_ignore.append(my_node) else: p_node = p_nodes[0] if (p_node.public_ips and p_node.state == NodeState.RUNNING): print "Node %s is ready" % my_node['id'] + sys.stdout.flush() db.setMachineState(my_node['uuid'], vmdatabase.READY) if (p_node.public_ips and p_node.state in [NodeState.UNKNOWN, NodeState.REBOOTING, NodeState.TERMINATED]): print "Node %s is in error" % my_node['id'] + sys.stdout.flush() db.setMachineState(my_node['uuid'], vmdatabase.ERROR) time.sleep(3)