Lava: Use Python3 for lava job submission
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 9 Jan 2017 21:25:51 +0000 (16:25 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 18 Jan 2017 19:44:17 +0000 (14:44 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
scripts/lttng-baremetal-tests/lava-submit.py
scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh
scripts/lttng-baremetal-tests/run-baremetal-tests.sh
scripts/lttng-baremetal-tests/run-kvm-tests.sh

index 2115718acb2cafbbff91165a3eabadeb100e4b65..5566e8a486f44bbb4bdade98e9ddd38068b2d745 100644 (file)
@@ -20,7 +20,7 @@ import json
 import os
 import sys
 import time
-import xmlrpclib
+import xmlrpc.client
 from collections import OrderedDict
 from enum import Enum
 
@@ -37,8 +37,8 @@ def get_job_bundle_content(server, job):
     try:
         bundle_sha = server.scheduler.job_status(str(job))['bundle_sha1']
         bundle = server.dashboard.get(bundle_sha)
-    except Fault as f:
-        print 'Error while fetching results bundle', f
+    except xmlrpc.client.Fault as f:
+        print('Error while fetching results bundle', f.faultString)
 
     return json.loads(bundle['content'])
 
@@ -85,7 +85,7 @@ def fetch_benchmark_results(server, job):
                         for a in res['attachments']:
                             # We only save the results file
                             if a['pathname'] in testcases:
-                                with open(a['pathname'],'w') as f:
+                                with open(a['pathname'],'wb') as f:
                                     # Convert the b64 representation of the
                                     # result file and write it to a file
                                     # in the current working directory
@@ -103,7 +103,7 @@ def print_test_output(server, job):
 
                     # Decode the base64 file and split on newlines to iterate
                     # on list
-                    testoutput = base64.b64decode(attachment['content']).split('\n')
+                    testoutput = str(base64.b64decode(bytes(attachment['content'], encoding='UTF-8'))).split('\n')
 
                     # Create a generator to iterate on the lines and keeping
                     # the state of the iterator across the two loops.
@@ -355,8 +355,8 @@ def main():
     lava_api_key = None
     try:
         lava_api_key = os.environ['LAVA_FRDESO_TOKEN']
-    except Exception, e:
-        print('LAVA_FRDESO_TOKEN not found in the environment variable. Exiting...')
+    except Exception as e:
+        print('LAVA_FRDESO_TOKEN not found in the environment variable. Exiting...', e )
         return -1
 
     if test_type is TestType.baremetal_benchmarks:
@@ -395,7 +395,7 @@ def main():
     else:
         assert False, 'Unknown test type'
 
-    server = xmlrpclib.ServerProxy('http://%s:%s@%s/RPC2' % (USERNAME, lava_api_key, HOSTNAME))
+    server = xmlrpc.client.ServerProxy('http://%s:%s@%s/RPC2' % (USERNAME, lava_api_key, HOSTNAME))
 
     jobid = server.scheduler.submit_job(json.dumps(j))
 
index 70f21059d6bef790be7a3faa2496079403677a9d..187205aaadf5aaf4a7ba9700c3ede9868a0ae3bc 100644 (file)
@@ -18,7 +18,7 @@ echo 'At this point, we built the modules and kernel if we needed to.'
 echo 'We can now launch the lava job using those artefacts'
 git clone https://github.com/lttng/lttng-ci
 
-python -u lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \
+python3 -u lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \
                           -t baremetal-benchmarks \
                           -j "$JOB_NAME" \
                           -k "$STORAGE_KERNEL_IMAGE" \
index b58cedec8c8530ede80dbf52233aa57bc813952f..1ddac2c66c359fd4a9cf527ecd594229349142f5 100644 (file)
@@ -18,7 +18,7 @@ echo 'At this point, we built the modules and kernel if we needed to.'
 echo 'We can now launch the lava job using those artefacts'
 git clone https://github.com/lttng/lttng-ci
 
-python -u lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \
+python3 -u lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \
                           -t baremetal-tests \
                           -j "$JOB_NAME" \
                           -k "$STORAGE_KERNEL_IMAGE" \
index 66c8babdb4792e97534045ff5cc8919545515129..217c92d94b9027f67bb1839bd7f7810964352f72 100644 (file)
@@ -18,7 +18,7 @@ echo 'At this point, we built the modules and kernel if we needed to.'
 echo 'We can now launch the lava job using those artefacts'
 git clone https://github.com/lttng/lttng-ci
 
-python -u lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \
+python3 -u lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \
                           -t kvm-tests \
                           -j "$JOB_NAME" \
                           -k "$STORAGE_KERNEL_IMAGE" \
This page took 0.025609 seconds and 4 git commands to generate.