[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 116: Use job_name filed in the job file to set the name of the job used for a

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

Commit Message

Paul Larson Sept. 20, 2011, 2:19 p.m.
------------------------------------------------------------
revno: 116
committer: Paul Larson <paul.larson@canonical.com>
branch nick: dispatcher-use-jobname2
timestamp: Mon 2011-09-19 21:35:31 -0500
message:
  Use job_name filed in the job file to set the name of the job used for a
  link in the dashboard
modified:
  lava_dispatcher/__init__.py
  lava_dispatcher/actions/launch_control.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

Patch

=== modified file 'lava_dispatcher/__init__.py'
--- lava_dispatcher/__init__.py	2011-09-09 04:34:34 +0000
+++ lava_dispatcher/__init__.py	2011-09-20 02:35:31 +0000
@@ -18,7 +18,6 @@ 
 # along
 # with this program; if not, see <http://www.gnu.org/licenses>.
 
-import sys
 from datetime import datetime
 import json
 import traceback
@@ -39,7 +38,8 @@ 
         self.load_job_data(job_json)
         dispatcher_config = get_config("lava-dispatcher")
         self.context = LavaContext(
-            self.target, self.image_type, dispatcher_config, oob_file)
+            self.target, self.image_type, dispatcher_config, oob_file,
+            self.job_data)
 
     def load_job_data(self, job_json):
         self.job_data = json.loads(job_json)
@@ -106,8 +106,9 @@ 
 
 
 class LavaContext(object):
-    def __init__(self, target, image_type, dispatcher_config, oob_file):
+    def __init__(self, target, image_type, dispatcher_config, oob_file, job_data):
         self.config = dispatcher_config
+        self.job_data = job_data
         device_config = get_device_config(target)
         if device_config.get('client_type') != 'conmux':
             raise RuntimeError(

=== modified file 'lava_dispatcher/actions/launch_control.py'
--- lava_dispatcher/actions/launch_control.py	2011-09-16 02:47:34 +0000
+++ lava_dispatcher/actions/launch_control.py	2011-09-20 02:35:31 +0000
@@ -42,9 +42,10 @@ 
             f = open(bundle)
             content = f.read()
             f.close()
+            job_name = self.context.job_data.get('job_name', "LAVA Results")
             try:
                 print >> self.context.oob_file, 'dashboard-put-result:', \
-                      dashboard.put_ex(content, bundle, stream)
+                      dashboard.put_ex(content, job_name, stream)
             except xmlrpclib.Fault, err:
                 print "xmlrpclib.Fault occurred"
                 print "Fault code: %d" % err.faultCode
@@ -150,8 +151,9 @@ 
             attributes.update(self.context.test_data.get_metadata())
             test_run['attributes'] = attributes
         json_bundle = json.dumps(main_bundle)
+        job_name = self.context.job_data.get('job_name', "LAVA Results")
         print >> self.context.oob_file, 'dashboard-put-result:', \
-              dashboard.put_ex(json_bundle, 'lava-dispatcher.bundle', stream)
+              dashboard.put_ex(json_bundle, job_name, stream)
 
         if status == 'fail':
             raise OperationFailed(err_msg)