In teuthology-worker, shuffle the child stdout/stderr into our log.

Otherwise, child can suffer a failure that does not get logged by
it's own exception handling machinery, and we have no idea why.
This commit is contained in:
Tommi Virtanen 2012-08-08 14:48:21 -07:00
parent 05007f7e0f
commit 99e99758e5

View 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!')