From 327c0ed98930e561cf240a2e4d0b2ddd2d4c1c84 Mon Sep 17 00:00:00 2001 From: Alina Quereilhac Date: Wed, 24 Sep 2014 11:49:06 +0200 Subject: [PATCH] Minor modifications to experiment runner --- examples/omf/nitos_omf6_ping.py | 5 ++++- src/nepi/execution/runner.py | 7 +++---- src/nepi/resources/linux/application.py | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/omf/nitos_omf6_ping.py b/examples/omf/nitos_omf6_ping.py index 8626af6a..0fcb2883 100644 --- a/examples/omf/nitos_omf6_ping.py +++ b/examples/omf/nitos_omf6_ping.py @@ -1,4 +1,6 @@ #!/usr/bin/env python + +############################################################################### # # NEPI, a framework to manage network experiments # Copyright (C) 2013 INRIA @@ -18,6 +20,8 @@ # # Authors: Alina Quereilhac # Julien Tribino +# +############################################################################### # Topology # @@ -41,7 +45,6 @@ # - t2 (t1 + 10s) : Ping stop # - t3 (t2 + 2s) : Kill the application # -# from nepi.execution.ec import ExperimentController from nepi.execution.resource import ResourceAction, ResourceState diff --git a/src/nepi/execution/runner.py b/src/nepi/execution/runner.py index 3a09ff4b..0afc7308 100644 --- a/src/nepi/execution/runner.py +++ b/src/nepi/execution/runner.py @@ -58,7 +58,7 @@ class ExperimentRunner(object): :param compute_metric_callback: function to invoke after each experiment run, to compute an experiment metric. It will be invoked with the ec and the run count as arguments, - and it must return a numeric value for the computed metric: + and it must return the metric value(s) computed for the run metric = compute_metric_callback(ec, run) @@ -68,7 +68,7 @@ class ExperimentRunner(object): collected metric samples have converged and the experiment runner can stop. It will be invoked with the ec, the run count and the list of collected metric samples as argument, and it must return - either True or False: + either True or False stop = evaluate_convergence_callback(ec, run, metrics) @@ -124,7 +124,7 @@ class ExperimentRunner(object): if len(samples) == 0: msg = "0 samples collected" raise RuntimeError, msg - + x = numpy.array(samples) n = len(samples) std = x.std() @@ -152,4 +152,3 @@ class ExperimentRunner(object): return ec - diff --git a/src/nepi/resources/linux/application.py b/src/nepi/resources/linux/application.py index ca9772d1..35a78849 100644 --- a/src/nepi/resources/linux/application.py +++ b/src/nepi/resources/linux/application.py @@ -644,11 +644,13 @@ class LinuxApplication(ResourceManager): (out, err), proc = self.node.kill(self.pid, self.ppid, sudo = self._sudo_kill) + """ # TODO: check if execution errors occurred if (proc and proc.poll()) or err: msg = " Failed to STOP command '%s' " % self.get("command") self.error(msg, out, err) - + """ + super(LinuxApplication, self).do_stop() def do_release(self): -- 2.43.0