diff -Nru lava-coordinator-0.1.4/PKG-INFO lava-coordinator-0.1.5/PKG-INFO --- lava-coordinator-0.1.4/PKG-INFO 2013-08-09 11:45:15.000000000 +0000 +++ lava-coordinator-0.1.5/PKG-INFO 2013-08-15 11:17:00.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: lava-coordinator -Version: 0.1.4 +Version: 0.1.5 Summary: LAVA Coordinator daemon for MultiNode Home-page: UNKNOWN Author: Neil Williams diff -Nru lava-coordinator-0.1.4/debian/changelog lava-coordinator-0.1.5/debian/changelog --- lava-coordinator-0.1.4/debian/changelog 2013-08-12 12:31:00.000000000 +0000 +++ lava-coordinator-0.1.5/debian/changelog 2013-08-15 10:42:53.000000000 +0000 @@ -1,3 +1,10 @@ +lava-coordinator (0.1.5-1) precise; urgency=low + + * Move bundles list into the group information to prevent cross- + contamination during aggregation. + + -- Neil Williams Thu, 15 Aug 2013 11:42:43 +0100 + lava-coordinator (0.1.4-1) precise; urgency=low * Add a full test suite, run during the build and modularise the diff -Nru lava-coordinator-0.1.4/lava/coordinator.py lava-coordinator-0.1.5/lava/coordinator.py --- lava-coordinator-0.1.4/lava/coordinator.py 2013-08-08 10:44:23.000000000 +0000 +++ lava-coordinator-0.1.5/lava/coordinator.py 2013-08-15 11:17:00.000000000 +0000 @@ -21,6 +21,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. + class LavaCoordinator(object): running = False @@ -28,13 +29,11 @@ rpc_delay = 2 blocksize = 4 * 1024 all_groups = {} - # FIXME: consider folding this into a data class? # All data handling for each connection happens on this local reference into the # all_groups dict with a new group looked up each time. group = None conn = None host = "localhost" - bundles = {} def __init__(self, json_data): """ @@ -134,7 +133,8 @@ 'roles': {}, 'syncs': {}, 'messages': {}, - 'waits': {} + 'waits': {}, + 'bundles': {} } def _clearGroupData(self, json_data): @@ -304,9 +304,10 @@ logging.debug("Aggregation called without a valid sub_id in the JSON") self._badRequest() return - self.bundles[client_name] = json_data["bundle"] + self.group['bundles'][client_name] = json_data["bundle"] if json_data["sub_id"].endswith(".0"): - if len(self.bundles) < self.group['count']: + logging.info("len:%d count:%d" % (len(self.group['bundles']), self.group['count'])) + if len(self.group['bundles']) < self.group['count']: logging.info("Waiting for the rest of the group to complete the job.") self._waitResponse() self.group['rpc_delay'] = self.rpc_delay @@ -318,7 +319,7 @@ self.group['rpc_delay'] -= 1 return logging.debug("Sending bundle list to sub_id zero") - msg = {"response": "ack", "message": {"bundle": self.bundles}} + msg = {"response": "ack", "message": {"bundle": self.group['bundles']}} msgdata = self._formatMessage(msg) if msgdata: self.conn.send(msgdata[0]) @@ -384,7 +385,7 @@ return if client in self.group['waits']: logging.debug("replying: %s for %s" % (self.group['waits'][client][messageID], client)) - if client in self.group['waits']: + if client_name in self.group['waits']: logging.debug("lavaWaitAll message: %s" % json.dumps(self.group['waits'][client_name][messageID])) else: for client in self.group['clients']: diff -Nru lava-coordinator-0.1.4/lava_coordinator.egg-info/PKG-INFO lava-coordinator-0.1.5/lava_coordinator.egg-info/PKG-INFO --- lava-coordinator-0.1.4/lava_coordinator.egg-info/PKG-INFO 2013-08-09 11:45:15.000000000 +0000 +++ lava-coordinator-0.1.5/lava_coordinator.egg-info/PKG-INFO 2013-08-15 11:17:00.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: lava-coordinator -Version: 0.1.4 +Version: 0.1.5 Summary: LAVA Coordinator daemon for MultiNode Home-page: UNKNOWN Author: Neil Williams diff -Nru lava-coordinator-0.1.4/setup.py lava-coordinator-0.1.5/setup.py --- lava-coordinator-0.1.4/setup.py 2013-08-09 11:44:04.000000000 +0000 +++ lava-coordinator-0.1.5/setup.py 2013-08-15 11:17:00.000000000 +0000 @@ -23,7 +23,7 @@ setup( name='lava-coordinator', - version="0.1.4", + version="0.1.5", author="Neil Williams", author_email="neil.williams@linaro.org", license="GPL2+", diff -Nru lava-coordinator-0.1.4/tests/testpoller.py lava-coordinator-0.1.5/tests/testpoller.py --- lava-coordinator-0.1.4/tests/testpoller.py 2013-08-08 11:41:52.000000000 +0000 +++ lava-coordinator-0.1.5/tests/testpoller.py 2013-08-15 11:17:00.000000000 +0000 @@ -30,6 +30,44 @@ from lava.coordinator import LavaCoordinator +bundle_sample = { + "test_runs": [ + {"software_context": { + "sources": [ + {"branch_url": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git", + "branch_vcs": "git", "project_name": + "multinode-yaml", "branch_revision": "f61e707c6d3da75d90735a75e6dc6aca55f1142b"}], + "image": {"name": ""}, "packages": [ + {"version": "1:2.0.16-1+deb7u1", "name": "acpid"}, + {"version": "1:1.2.7.dfsg-13", "name": "zlib1g"}]}, + "attachments": [ + {"content": "", "pathname": "stdout.log", "mime_type": "text/plain"}, + {"content": "", "pathname": "testdef.yaml", "mime_type": "text/plain"}, + {"content": "MAo=", "pathname": "return_code", "mime_type": "text/plain"}, + {"content": "", "pathname": "run.sh", "mime_type": "text/plain"}], + "analyzer_assigned_date": "2013-08-13T19:27:41Z", + "time_check_performed": False, + "test_results": [ + {"result": "pass", "attributes": {}, + "attachments": [], "test_case_id": "linux-linaro-ubuntu-pwd"}, + {"result": "pass", "attributes": {}, "attachments": [], "test_case_id": "multinode-role-output"}, + {"result": "pass", "attributes": {}, "attachments": [], "test_case_id": "multinode-lava-network"}], + "testdef_metadata": { + "description": "Basic MultiNode test commands for Linux Linaro ubuntu Images", + "format": "Lava-Test Test Definition 1.0", + "url": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git", + "version": "f61e707c6d3da75d90735a75e6dc6aca55f1142b", "location": "GIT"}, + "hardware_context": { + "devices": [ + {"attributes": {"power management": "", "cpuid level": "4", "model": "2", "wp": "yes"}, + "description": "Processor #0"}]}, + "analyzer_assigned_uuid": "2eb4898b-ba33-42e1-ab71-025f18feef81", "attributes": + {"target_group": "da4ed985-80e9-43bf-acd5-4e18d03300b9", "target": + "multinode-kvm01", "target.hostname": "multinode-kvm01", "target.device_version": "1.0", + "role": "felix", "target.device_type": "kvm", "logging_level": "DEBUG", "group_size": "2"}, + "test_id": "smoke-tests-multinode"}], "format": "Dashboard Bundle Format 1.6"} + + class TestSignals(object): message_str = '' @@ -76,6 +114,7 @@ return assert 'response' in json_data self.log.info("\tCoordinator response: '%s'" % json_data['response']) + self.log.info("\tdebug: %s" % json.dumps(json_data)) assert(json_data['response'] == self.response) self.passes += 1 if self.message: @@ -643,6 +682,55 @@ self.coord.dataReceived(self._wrapMessage(wait_msg, "tester")) self._cleanup() + def test_18_aggregation(self): + """ Check that a syb_id zero waits for all pending result bundles + """ + self.coord.newGroup(3) + self.coord.addClient("controller") + self.coord.addClient("node_one") + self.coord.addClient("node_two") + self.log = logging.getLogger("testCase") + self._switch_client("controller") + self.coord.expectResponse("nack") + send_msg = {"request": "aggregate"} + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + send_msg["bundle"] = None + self.coord.expectResponse("nack") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + send_msg["sub_id"] = None + self.coord.expectResponse("nack") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + # It is OK to reuse the same bundle - only the database cares about duplicate assigned_uuid fields etc. + send_msg['bundle'] = bundle_sample + self.coord.expectResponse("nack") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self.log.info("Setting a zero sub_id - expect wait") + send_msg["sub_id"] = "10.0" + for _ in range(6): + self.coord.expectResponse("wait") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self._switch_client("node_one") + send_msg["sub_id"] = "10.1" + self.coord.expectResponse("ack") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self._switch_client("controller") + send_msg["sub_id"] = "10.0" + for _ in range(6): + self.coord.expectResponse("wait") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self._switch_client("node_two") + send_msg["sub_id"] = "10.2" + self.coord.expectResponse("ack") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self._switch_client("controller") + send_msg["sub_id"] = "10.0" + for _ in range(self.coord.rpc_delay): + self.coord.expectResponse("wait") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self.coord.expectResponse("ack") + self.coord.dataReceived(self._wrapMessage(send_msg, "tester")) + self._cleanup() + def main(): FORMAT = '%(msg)s'