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
|
|
@ -6,7 +6,7 @@ set -e
|
|||
|
||||
echo "Install the dependencies of the vigil script..."
|
||||
sudo apt-get --yes install python3-minimal python3-pygments python3-pyinotify \
|
||||
python3-urwid python3-psutil python3-docopt util-linux
|
||||
python3-urwid python3-docopt util-linux
|
||||
echo
|
||||
echo "Install all the tools vigil may need..."
|
||||
./install-tools
|
||||
|
|
|
|||
2
vigil
2
vigil
|
|
@ -918,7 +918,7 @@ def save_state(pickle_path, summary, screen, log):
|
|||
def main(root_path, loop, worker_count=None, is_sandboxed=True,
|
||||
editor_command=None, is_being_tested=False):
|
||||
if worker_count is None:
|
||||
worker_count = multiprocessing.cpu_count() * 2
|
||||
worker_count = multiprocessing.cpu_count()
|
||||
pickle_path = os.path.join(tools.CACHE_PATH, "summary.pickle")
|
||||
jobs_added_event = asyncio.Event()
|
||||
appearance_changed_event = asyncio.Event()
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ import shutil
|
|||
import tempfile
|
||||
import unittest
|
||||
|
||||
import psutil
|
||||
|
||||
os.environ["TERM"] = "xterm-256color"
|
||||
|
||||
import fill3
|
||||
|
|
@ -213,17 +211,12 @@ def _tmp_total():
|
|||
return len(os.listdir("/tmp"))
|
||||
|
||||
|
||||
def _all_processes():
|
||||
return set(psutil.process_iter())
|
||||
|
||||
|
||||
class MainTestCase(unittest.TestCase):
|
||||
|
||||
def test_main_and_restart_and_no_leaks_and_is_relocatable(self):
|
||||
def test_run(root_path, loop):
|
||||
mount_total = _mount_total()
|
||||
# tmp_total = _tmp_total()
|
||||
# processes = _all_processes()
|
||||
foo_path = os.path.join(root_path, "foo")
|
||||
open(foo_path, "w").close()
|
||||
vigil.manage_cache(root_path)
|
||||
|
|
@ -236,7 +229,6 @@ class MainTestCase(unittest.TestCase):
|
|||
self.assertTrue(os.path.exists(".vigil/" + file_name))
|
||||
self.assertEqual(_mount_total(), mount_total)
|
||||
# self.assertEqual(_tmp_total(), tmp_total)
|
||||
# self.assertEqual(_all_processes(), processes) # Fix
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
try:
|
||||
loop = asyncio.get_event_loop()
|
||||
|
|
|
|||
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