Commit e186a4a0 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

minor fixes

parent 0b2831bc
......@@ -617,8 +617,10 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
profconfs = ppconf.xpath('d:profConf', namespaces=ns)
xmlblock = "<obsPowerprofConf>\n"
for profconf in profconfs:
duration = profconf.xpath('d:duration', namespaces=ns)[0].text.strip()
if not duration:
duration = profconf.xpath('d:duration', namespaces=ns)
if duration:
duration = duration[0].text.strip()
else:
try:
duration = int(profconf.xpath('d:durationMillisecs', namespaces=ns)[0].text.strip()) / 1000
except:
......@@ -828,8 +830,7 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
return (errors, warnings)
except Exception:
msg = "Unexpected error: %s: %s\n%s" % (str(sys.exc_info()[0]), str(sys.exc_info()[1]), traceback.format_exc())
print(msg)
logger.warn(msg)
logger.error(msg)
raise
### END start_test()
......@@ -950,8 +951,7 @@ def stop_test(testid, cur, cn, obsdict_key, obsdict_id, abort=False):
return (errors, warnings)
except Exception:
msg = "Unexpected error: %s: %s\n%s" % (str(sys.exc_info()[0]), str(sys.exc_info()[1]), traceback.format_exc())
print(msg)
logger.warn(msg)
logger.error(msg)
raise
### END stop_test()
......@@ -967,14 +967,13 @@ def prepare_testresults(testid, cur):
are running, it may take a long time for this function to finish as it will wait
for these functions to succeed.
"""
errors = []
tree = None
# Check if results directory exists
testresultsdir = "%s/%d" % (flocklab.config.get('fetcher', 'testresults_dir'), testid)
if not os.path.isdir(testresultsdir):
errors.append("Test results directory does not exist.")
logger.warn("Test results directory does not exist.")
return errors
logger.debug("Preparing testresults...")
......
......@@ -948,6 +948,8 @@ def main(argv):
elif service == 'gpiotracing':
header = 'timestamp,observer_id,node_id,pin_name,value\n'
elif service == 'powerprofiling':
if ppFileFormat == 'rld':
continue # don't open a csv file
header = 'timestamp,observer_id,node_id,current[mA],voltage[V]\n'
elif service == 'serial':
header = 'timestamp,observer_id,node_id,direction,output\n'
......
......@@ -90,7 +90,6 @@ def obs_connect_process(conreqQueue, condoneQueue, _stopevent):
logger.info("Could not connect to observer %s on port %d, dropping connection." % (w[0],w[1]))
except Exception:
logger.info("Could not connect to observer %s on port %d: %s, %s\n%s" % (w[0], w[1], str(sys.exc_info()[0]), str(sys.exc_info()[1]), traceback.format_exc()))
pass
finally:
worklist.remove(w)
### END obs_connect_process
......
......@@ -1276,6 +1276,6 @@ def parse_int(s):
res = int(float(s.strip())) # higher success rate if first parsed to float
except ValueError:
if logger:
logger.warning("Could not parse %s to int." % (str(s)))
logger.warn("Could not parse %s to int." % (str(s)))
return res
### END parse_int()
......@@ -601,7 +601,7 @@ def main(argv):
for elem in rs:
ppStart = int(elem.text)
elem2 = elem.getparent().find('d:durationMillisecs', namespaces=ns)
if elem2:
if elem2 is not None:
ppDuration = int(elem2.text) / 1000
else:
elem2 = elem.getparent().find('d:duration', namespaces=ns)
......@@ -623,7 +623,7 @@ def main(argv):
else:
ppStart = int(elem.text)
elem2 = elem.getparent().getparent().find('d:durationMillisecs', namespaces=ns)
if elem2:
if elem2 is not None:
ppDuration = int(elem2.text) / 1000
else:
elem2 = elem.getparent().getparent().find('d:duration', namespaces=ns)
......@@ -651,7 +651,7 @@ def main(argv):
else:
ppStart = eventTime
elem2 = elem.getparent().getparent().find('d:durationMillisecs', namespaces=ns)
if elem2:
if elem2 is not None:
ppDuration = int(elem2.text) / 1000
else:
elem2 = elem.getparent().getparent().find('d:duration', namespaces=ns)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment