Correctly nice and ionice the worker processes.
This had stopped working. Unfortunately it doesn't seem to help anyway. Ideally the responsiveness of the interface is the same, regardless of whether the workers are paused or not. Atm its much better when they are paused.
This commit is contained in:
parent
ca33199456
commit
4b48c0c912
4 changed files with 5 additions and 18 deletions
11
worker.py
11
worker.py
|
|
@ -7,15 +7,11 @@ import asyncio
|
|||
import os
|
||||
import signal
|
||||
|
||||
import psutil
|
||||
|
||||
import tools
|
||||
|
||||
|
||||
def _make_process_nicest(pid):
|
||||
process = psutil.Process(pid)
|
||||
process.nice(19)
|
||||
process.ionice(psutil.IOPRIO_CLASS_IDLE)
|
||||
def nice_command(command):
|
||||
return ["nice", "-n", "19", "ionice", "-c", "3"] + command
|
||||
|
||||
|
||||
class Worker:
|
||||
|
|
@ -37,7 +33,7 @@ class Worker:
|
|||
else:
|
||||
command = [__file__]
|
||||
create = asyncio.create_subprocess_exec(
|
||||
*command, stdin=asyncio.subprocess.PIPE,
|
||||
*nice_command(command), stdin=asyncio.subprocess.PIPE,
|
||||
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,
|
||||
preexec_fn=os.setsid)
|
||||
self.process = await create
|
||||
|
|
@ -53,7 +49,6 @@ class Worker:
|
|||
async def job_runner(self, summary, log, jobs_added_event,
|
||||
appearance_changed_event):
|
||||
await self.create_process()
|
||||
_make_process_nicest(self.child_pgid)
|
||||
while True:
|
||||
await jobs_added_event.wait()
|
||||
while True:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue