#
# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
-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.linux.ccn.ccnd import LinuxCCND
if self.ccnd: return self.ccnd.node
return None
- def deploy(self):
+ def do_deploy(self):
if not self.ccnd or self.ccnd.state < ResourceState.READY:
self.debug("---- RESCHEDULING DEPLOY ---- node state %s " % self.node.state )
self.ec.schedule(reschedule_delay, self.deploy)
else:
- try:
- command = self.get("command") or ""
+ command = self.get("command") or ""
- self.info("Deploying command '%s' " % command)
-
- if not self.get("env"):
- self.set("env", self._environment)
+ self.info("Deploying command '%s' " % command)
+
+ if not self.get("env"):
+ self.set("env", self._environment)
+
+ self.do_discover()
+ self.do_provision()
- self.discover()
- self.provision()
- except:
- self.fail()
- raise
-
self.debug("----- READY ---- ")
- self._ready_time = tnow()
- self._state = ResourceState.READY
+ self.set_ready()
@property
def _environment(self):
return self.ccnd.path
- def execute_command(self, command, env):
- environ = self.node.format_environment(env, inline = True)
- command = environ + command
- command = self.replace_paths(command)
-
- return self.node.execute(command)
-
def valid_connection(self, guid):
# TODO: Validate!
return True