X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nepi%2Fresources%2Flinux%2Fapplication.py;h=e4086b8d93156d5514b1b87cc0b25dfeed21f11f;hb=ddb5d7e50ffef50b41186199de2a9b6b21850bf8;hp=ba9bbc38384baace992fe8deb89daec28c30ff51;hpb=40b568db5ed0ba760da8b14a00814db7d01a3944;p=nepi.git diff --git a/nepi/resources/linux/application.py b/nepi/resources/linux/application.py index ba9bbc38..e4086b8d 100644 --- a/nepi/resources/linux/application.py +++ b/nepi/resources/linux/application.py @@ -16,6 +16,10 @@ # # Author: Alina Quereilhac +import os +import subprocess +import logging + from nepi.execution.attribute import Attribute, Flags, Types from nepi.execution.trace import Trace, TraceAttr from nepi.execution.resource import ResourceManager, clsinit_copy, \ @@ -24,8 +28,9 @@ from nepi.resources.linux.node import LinuxNode from nepi.util.sshfuncs import ProcStatus, STDOUT from nepi.util.timefuncs import tnow, tdiffsec -import os -import subprocess +# to debug, just use +# logging.getLogger('application').setLevel(logging.DEBUG) +logger = logging.getLogger("application") # TODO: Resolve wildcards in commands!! # TODO: When a failure occurs during deployment, scp and ssh processes are left running behind!! @@ -168,11 +173,10 @@ class LinuxApplication(ResourceManager): @classmethod def _register_traces(cls): - stdout = Trace("stdout", "Standard output stream", enabled = True) - stderr = Trace("stderr", "Standard error stream", enabled = True) - - cls._register_trace(stdout) - cls._register_trace(stderr) + cls._register_trace( + Trace("stdout", "Standard output stream", enabled = True)) + cls._register_trace( + Trace("stderr", "Standard error stream", enabled = True)) def __init__(self, ec, guid): super(LinuxApplication, self).__init__(ec, guid) @@ -249,6 +253,7 @@ class LinuxApplication(ResourceManager): self.info("Retrieving '{}' trace {} ".format(name, attr)) path = self.trace_filepath(name) + logger.debug("trace: path= {}".format(path)) command = "(test -f {} && echo 'success') || echo 'error'".format(path) (out, err), proc = self.node.execute(command) @@ -724,10 +729,15 @@ class LinuxApplication(ResourceManager): = self.node.check_errors(self.run_home) if err: - msg = "Failed to execute command '{}'"\ - .format(self.get("command")) - self.error(msg, out, err) - self.do_fail() + # Thierry : there's nothing wrong with a non-empty + # stderr, is there ? + #msg = "Failed to execute command '{}'"\ + # .format(self.get("command")) + #self.error(msg, out, err) + #self.do_fail() + # xxx TODO OTOH it would definitely make sense + # to check the exitcode + pass else: self.set_stopped()