]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
In teuthology-worker, shuffle the child stdout/stderr into our log.
authorTommi Virtanen <tv@inktank.com>
Wed, 8 Aug 2012 21:48:21 +0000 (14:48 -0700)
committerTommi Virtanen <tv@inktank.com>
Wed, 8 Aug 2012 21:48:21 +0000 (14:48 -0700)
Otherwise, child can suffer a failure that does not get logged by
it's own exception handling machinery, and we have no idea why.

teuthology/queue.py

index b6b178e1b932aef9b2982e96bb859701269e2b53..9d6e865af33563d26b2beab930c190819390c57c 100644 (file)
@@ -123,12 +123,17 @@ def run_job(job_config, archive_path):
         ) as tmp:
         os.write(tmp, yaml.safe_dump(job_config['config']))
         arg.append(tmp.name)
-        try:
-            subprocess.check_call(
-                args=arg,
-                close_fds=True,
-                )
-        except subprocess.CalledProcessError as e:
-            log.exception(e)
+        p = subprocess.Popen(
+            args=arg,
+            close_fds=True,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.STDOUT,
+            )
+        child = logging.getLogger(__name__ + '.child')
+        for line in p.stdout:
+            child.info(': %s', line.rstrip('\n'))
+        p.wait()
+        if p.returncode != 0:
+            log.error('Child exited with code %s', e)
         else:
             log.info('Success!')