X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Fccn_emu_live%2Fdce.py;h=4b51b170154832b173ceb0e7f9b9fbf19053b32e;hb=cb5d027b813a27d7de263653e1a8e0cef5490f0a;hp=7f490a4f1b3e27215519a60001876eee00762316;hpb=e55924b6886bd7382a28e1ae235c4810f852e163;p=nepi.git diff --git a/examples/ccn_emu_live/dce.py b/examples/ccn_emu_live/dce.py index 7f490a4f..4b51b170 100644 --- a/examples/ccn_emu_live/dce.py +++ b/examples/ccn_emu_live/dce.py @@ -17,6 +17,8 @@ # # Author: Alina Quereilhac +from __future__ import print_function + from nepi.execution.ec import ExperimentController from nepi.execution.runner import ExperimentRunner from nepi.util.netgraph import NetGraph, TopologyType @@ -166,10 +168,9 @@ def avg_interests(ec, run): # TODO: DUMP RESULTS TO FILE # TODO: DUMP GRAPH DELAYS! - f = open("/tmp/metric", "a+") - f.write("%.2f\n" % metric) - f.close() - print " METRIC", metric + with open("/tmp/metric", "a+") as f: + f.write("%.2f\n" % metric) + print(" METRIC", metric) return metric @@ -211,7 +212,7 @@ if __name__ == '__main__': add_node_callback = add_dce_node, add_edge_callback = add_dce_edge) - print "Results stored at", ec.exp_dir + print("Results stored at", ec.exp_dir) #### Retrieve the consumer to wait for ot to finish ccncat = ec.filter_resources("linux::ns3::dce::CCNCat")