Feat: Integrate message in service, scheduler and dispatcher
This commit is contained in:
0
test/fakes/__init__.py
Normal file
0
test/fakes/__init__.py
Normal file
10
test/fakes/dispatcher.py
Normal file
10
test/fakes/dispatcher.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from bopytex.worker import Dispatcher
|
||||
from .workers import fake_worker, success_worker, fail_worker
|
||||
|
||||
fake_dispatcher = Dispatcher(
|
||||
{
|
||||
"FAKE": fake_worker,
|
||||
"SUCCESS": success_worker,
|
||||
"FAILURE": fail_worker,
|
||||
}
|
||||
)
|
||||
9
test/fakes/planner.py
Normal file
9
test/fakes/planner.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from bopytex.tasks import Task
|
||||
|
||||
|
||||
def simple(options: dict) -> list[Task]:
|
||||
"""Simple planner with options['quantity'] tasks and no dependencies"""
|
||||
return [
|
||||
Task("FAKE", args={"number": i}, deps=[], output=f"{i}")
|
||||
for i in range(options["quantity"])
|
||||
]
|
||||
13
test/fakes/workers.py
Normal file
13
test/fakes/workers.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from bopytex.message import Message
|
||||
|
||||
def fake_worker(args, deps, output):
|
||||
return Message(0, [f"FAKE - {args} - {deps} - {output}"], [])
|
||||
|
||||
|
||||
def success_worker(args, deps, output):
|
||||
return Message(0, [f"SUCCESS - {args} - {deps} - {output}"], [])
|
||||
|
||||
|
||||
def fail_worker():
|
||||
return Message(1, [f"FAILURE - {args} - {deps} - {output}"], [])
|
||||
|
||||
Reference in New Issue
Block a user