replace eris-worker subprocess with ProcessPoolExecutor; guard sweep generators against empty _entries
- Rewrite worker.py: each Worker uses a ProcessPoolExecutor(max_workers=1), tools run via loop.run_in_executor() in a forked OS subprocess - Remove create_process(), main(), stdin/stdout IPC, os.killpg - Remove eris-worker entry point from [project.scripts] in pyproject.toml - Update tests/worker_test.py for new Worker API - Guard _sweep_up/_sweep_down against IndexError when _entries is empty; keep cursor_position() try/except for stale y after row deletion
This commit is contained in:
parent
3925ded957
commit
ed6457a0f0
5 changed files with 44 additions and 56 deletions
|
|
@ -19,16 +19,16 @@ class WorkerTestCase(unittest.TestCase):
|
|||
open("foo", "w").close()
|
||||
|
||||
def tearDown(self):
|
||||
if hasattr(self, "worker_"):
|
||||
self.worker_.kill()
|
||||
shutil.rmtree(self.temp_dir)
|
||||
os.chdir(self.original_working_dir)
|
||||
|
||||
def test_run_job(self):
|
||||
loop = asyncio.new_event_loop()
|
||||
compression = "none"
|
||||
worker_ = worker.Worker(compression)
|
||||
loop.run_until_complete(worker_.create_process())
|
||||
worker_.process.stdin.write(f"{compression}\n".encode("utf-8"))
|
||||
future = worker_.run_tool("foo", tools.metadata)
|
||||
self.worker_ = worker.Worker(compression)
|
||||
future = self.worker_.run_tool("foo", tools.metadata)
|
||||
status = loop.run_until_complete(future)
|
||||
self.assertEqual(status, tools.Status.ok)
|
||||
result_path = os.path.join(tools.CACHE_PATH, "foo-metadata")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue