nothing wrong with a stderr being not empty
[nepi.git] / nepi / resources / linux / application.py
index ba9bbc3..e4086b8 100644 (file)
 #
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
+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()