Skip to content

Commit

Permalink
ctlmgr,worker: set PYTHONUNBUFFERED for subprocesses
Browse files Browse the repository at this point in the history
sbourdeauducq committed Feb 18, 2016

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent ca3cced commit 155c2ec
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion artiq/devices/ctlmgr.py
Original file line number Diff line number Diff line change
@@ -81,9 +81,12 @@ async def launcher(self):
logger.info("Starting controller %s with command: %s",
self.name, self.command)
try:
env = os.environ.copy()
env["PYTHONUNBUFFERED"] = "1"
self.process = await asyncio.create_subprocess_exec(
*shlex.split(self.command),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
asyncio.ensure_future(
LogParser(self._get_log_source).stream_task(
self.process.stdout))
5 changes: 4 additions & 1 deletion artiq/master/worker.py
Original file line number Diff line number Diff line change
@@ -81,10 +81,13 @@ async def _create_process(self, log_level):
if self.closed.is_set():
raise WorkerError("Attempting to create process after close")
self.ipc = pipe_ipc.AsyncioParentComm()
env = os.environ.copy()
env["PYTHONUNBUFFERED"] = "1"
await self.ipc.create_subprocess(
sys.executable, "-m", "artiq.master.worker_impl",
self.ipc.get_address(), str(log_level),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
asyncio.ensure_future(
LogParser(self._get_log_source).stream_task(
self.ipc.process.stdout))

0 comments on commit 155c2ec

Please sign in to comment.