forked from M-Labs/artiq
ctlmgr,worker: set PYTHONUNBUFFERED for subprocesses
This commit is contained in:
parent
ca3cced0b4
commit
155c2ec2ef
|
@ -81,9 +81,12 @@ class Controller:
|
||||||
logger.info("Starting controller %s with command: %s",
|
logger.info("Starting controller %s with command: %s",
|
||||||
self.name, self.command)
|
self.name, self.command)
|
||||||
try:
|
try:
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["PYTHONUNBUFFERED"] = "1"
|
||||||
self.process = await asyncio.create_subprocess_exec(
|
self.process = await asyncio.create_subprocess_exec(
|
||||||
*shlex.split(self.command),
|
*shlex.split(self.command),
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
env=env)
|
||||||
asyncio.ensure_future(
|
asyncio.ensure_future(
|
||||||
LogParser(self._get_log_source).stream_task(
|
LogParser(self._get_log_source).stream_task(
|
||||||
self.process.stdout))
|
self.process.stdout))
|
||||||
|
|
|
@ -81,10 +81,13 @@ class Worker:
|
||||||
if self.closed.is_set():
|
if self.closed.is_set():
|
||||||
raise WorkerError("Attempting to create process after close")
|
raise WorkerError("Attempting to create process after close")
|
||||||
self.ipc = pipe_ipc.AsyncioParentComm()
|
self.ipc = pipe_ipc.AsyncioParentComm()
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["PYTHONUNBUFFERED"] = "1"
|
||||||
await self.ipc.create_subprocess(
|
await self.ipc.create_subprocess(
|
||||||
sys.executable, "-m", "artiq.master.worker_impl",
|
sys.executable, "-m", "artiq.master.worker_impl",
|
||||||
self.ipc.get_address(), str(log_level),
|
self.ipc.get_address(), str(log_level),
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
env=env)
|
||||||
asyncio.ensure_future(
|
asyncio.ensure_future(
|
||||||
LogParser(self._get_log_source).stream_task(
|
LogParser(self._get_log_source).stream_task(
|
||||||
self.ipc.process.stdout))
|
self.ipc.process.stdout))
|
||||||
|
|
Loading…
Reference in New Issue