Feat: move action to worker with a dispatcher
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
from bopytex.planner import fake_planner
|
||||
from bopytex.service import orcherstrator
|
||||
from bopytex.tasks import Task
|
||||
from bopytex.worker import Dispatcher, fake_worker
|
||||
|
||||
|
||||
def test_service():
|
||||
options = {"quantity": 3, "template": "tpl_src.tex"}
|
||||
service = orcherstrator(options, fake_planner.simple)
|
||||
for i, task in enumerate(service):
|
||||
assert task == Task("Do", args={"number": i}, deps=[], output=f"{i}")
|
||||
dispatcher = Dispatcher(actions={"DO": fake_worker})
|
||||
|
||||
service = orcherstrator(options, fake_planner.simple, dispatcher)
|
||||
|
||||
for i, task_output in enumerate(service):
|
||||
assert task_output == f"FAKE - {{'number': {i}}} - [] - {i}"
|
||||
|
||||
Reference in New Issue
Block a user