X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fplanetlab%2Ftap.py;h=411eb5149e10a7f396693eb59512e9ebe25a4b7e;hb=bf43c83ced9389c8fa9468d7c23f67d35af963da;hp=01e7b144f6d1e4eefdf3be7e5b000b0f7b51ec7b;hpb=e219e0dbd16174fed127a613fb0a0fb3203609f3;p=nepi.git diff --git a/src/nepi/resources/planetlab/tap.py b/src/nepi/resources/planetlab/tap.py index 01e7b144..411eb514 100644 --- a/src/nepi/resources/planetlab/tap.py +++ b/src/nepi/resources/planetlab/tap.py @@ -18,7 +18,7 @@ # Author: Alina Quereilhac from nepi.execution.attribute import Attribute, Flags, Types -from nepi.execution.resource import ResourceManager, clsinit_copy, ResourceState, \ +from nepi.execution.resource import clsinit_copy, ResourceState, \ reschedule_delay from nepi.resources.linux.application import LinuxApplication from nepi.resources.planetlab.node import PlanetlabNode @@ -166,35 +166,31 @@ class PlanetlabTap(LinuxApplication): raise self.debug("----- READY ---- ") - self._ready_time = tnow() - self._state = ResourceState.READY + self.set_ready() def start(self): - if self._state == ResourceState.READY: + if self.state == ResourceState.READY: command = self.get("command") self.info("Starting command '%s'" % command) - self._start_time = tnow() - self._state = ResourceState.STARTED + self.set_started() else: msg = " Failed to execute command '%s'" % command self.error(msg, out, err) - self._state = ResourceState.FAILED + self.fail() raise RuntimeError, msg def stop(self): command = self.get('command') or '' - state = self.state - if state == ResourceState.STARTED: + if self.state == ResourceState.STARTED: self.info("Stopping command '%s'" % command) command = "bash %s" % os.path.join(self.app_home, "stop.sh") (out, err), proc = self.execute_command(command, blocking = True) - self._stop_time = tnow() - self._state = ResourceState.STOPPED + self.set_stopped() @property def state(self): @@ -208,6 +204,7 @@ class PlanetlabTap(LinuxApplication): if out.strip().find(self.get("deviceName")) == -1: # tap is not running is not running (socket not found) + self._finish_time = tnow() self._state = ResourceState.FINISHED self._last_state_check = tnow()