diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 576: Evolve bundle stream format to 1.6 which adds testdef_metadata.

Message ID 20130408010313.27296.46794.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Senthil Kumaran April 8, 2013, 1:03 a.m. UTC
Merge authors:
  Senthil Kumaran S (stylesen)
Related merge proposals:
  https://code.launchpad.net/~stylesen/lava-dispatcher/evolve-bundle-stream-1.6/+merge/150519
  proposed by: Senthil Kumaran S (stylesen)
  review: Approve - Antonio Terceiro (terceiro)
  review: Needs Fixing - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 576 [merge]
committer: Senthil Kumaran <senthil.kumaran@linaro.org>
branch nick: trunk
timestamp: Mon 2013-04-08 00:04:33 +0530
message:
  Evolve bundle stream format to 1.6 which adds testdef_metadata.
modified:
  lava_dispatcher/actions/launch_control.py
  lava_dispatcher/actions/lava_test_shell.py
  lava_dispatcher/lava_test_shell.py
  lava_dispatcher/test_data.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/actions/launch_control.py'
--- lava_dispatcher/actions/launch_control.py	2013-01-23 22:37:05 +0000
+++ lava_dispatcher/actions/launch_control.py	2013-01-30 10:30:37 +0000
@@ -209,7 +209,7 @@ 
         if not all_bundles:
             main_bundle = {
                      "test_runs": [],
-                     "format": "Dashboard Bundle Format 1.5"
+                     "format": "Dashboard Bundle Format 1.6"
                    }
         else:
             main_bundle = all_bundles.pop(0)

=== modified file 'lava_dispatcher/actions/lava_test_shell.py'
--- lava_dispatcher/actions/lava_test_shell.py	2013-02-11 02:31:22 +0000
+++ lava_dispatcher/actions/lava_test_shell.py	2013-04-07 10:53:18 +0000
@@ -204,9 +204,9 @@ 
 
 def _get_testdef_info(testdef):
     metadata = {'os': '', 'devices': '', 'environment': ''}
-    metadata['version'] = str(testdef['metadata'].get('version'))
-    metadata['description'] = str(testdef['metadata'].get('description'))
-    metadata['format'] = str(testdef['metadata'].get('format'))
+    metadata['description'] = testdef['metadata'].get('description', None)
+    metadata['format'] = testdef['metadata'].get('format', None)
+    metadata['version'] = testdef['metadata'].get('version', None)
 
     # Convert list to comma separated string.
     if testdef['metadata'].get('os'):
@@ -404,7 +404,7 @@ 
             f.write(self.uuid)
 
         with open('%s/testdef_metadata' % hostdir, 'w') as f:
-            f.write(yaml.dump(self.testdef_metadata))
+            f.write(yaml.safe_dump(self.testdef_metadata))
 
         if 'install' in self.testdef:
             self._create_repos(hostdir)
@@ -439,8 +439,8 @@ 
         testdef_metadata = {}
         testdef_metadata.update({'url': info['branch_url']})
         testdef_metadata.update({'location': info['branch_vcs'].upper()})
-        testdef_metadata.update({'repo_rev': info['branch_revision']})
         testdef_metadata.update(_get_testdef_info(testdef))
+        testdef_metadata.update({'version': info['branch_revision']})
 
         URLTestDefinition.__init__(self, context, idx, testdef,
                                    testdef_metadata)

=== modified file 'lava_dispatcher/lava_test_shell.py'
--- lava_dispatcher/lava_test_shell.py	2013-02-11 02:31:22 +0000
+++ lava_dispatcher/lava_test_shell.py	2013-04-05 09:27:07 +0000
@@ -284,6 +284,25 @@ 
     return attachments
 
 
+def _get_run_testdef_metadata(test_run_dir):
+    testdef_metadata = {
+        'version': None,
+        'description': None,
+        'format': None,
+        'location': None,
+        'url': None,
+        'os': None,
+        'devices': None,
+        'environment': None
+        }
+
+    metadata = _read_content(os.path.join(test_run_dir, 'testdef_metadata'))
+    if metadata is not '':
+        testdef_metadata = yaml.safe_load(metadata)
+    
+    return testdef_metadata
+
+
 def _get_test_run(test_run_dir, hwcontext, build, pkginfo, testdefs_by_uuid):
     now = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
 
@@ -292,11 +311,9 @@ 
     uuid = _read_content(os.path.join(test_run_dir, 'analyzer_assigned_uuid'))
     attachments = _get_run_attachments(test_run_dir, testdef, stdout)
     attributes = _attributes_from_dir(os.path.join(test_run_dir, 'attributes'))
-    # XXX testdef_metadata = _read_content(os.path.join(test_run_dir,
-    # XXX                                              'testdef_metadata'))
 
     testdef = yaml.safe_load(testdef)
-    # XXX testdef_metadata = yaml.safe_load(testdef_metadata)
+
     if uuid in testdefs_by_uuid:
         sw_sources = testdefs_by_uuid[uuid]._sw_sources
     else:
@@ -314,8 +331,8 @@ 
         'hardware_context': hwcontext,
         'attachments': attachments,
         'attributes': attributes,
-        # XXX 'testdef_metadata': testdef_metadata,
-    }
+        'testdef_metadata': _get_run_testdef_metadata(test_run_dir)
+        }
 
 
 def _read_content(filepath, ignore_missing=False):
@@ -354,4 +371,4 @@ 
             except:
                 logging.exception('error processing results for: %s' % test_run_name)
 
-    return {'test_runs': testruns, 'format': 'Dashboard Bundle Format 1.5'}
+    return {'test_runs': testruns, 'format': 'Dashboard Bundle Format 1.6'}

=== modified file 'lava_dispatcher/test_data.py'
--- lava_dispatcher/test_data.py	2013-01-30 05:33:55 +0000
+++ lava_dispatcher/test_data.py	2013-03-25 19:41:18 +0000
@@ -34,8 +34,7 @@ 
     def __init__(self, test_id='lava'):
         self.job_status = 'pass'
         self.metadata = {}
-        self._test_run = { 'test_results':[], 'attachments':[], 'tags':[], }
-                           # XXX 'testdef_metadata':{} }
+        self._test_run = { 'test_results':[], 'attachments':[], 'tags':[] }
         self._test_run['test_id'] = test_id
         self._assign_date()
         self._assign_uuid()