swh.scheduler.simulator package#

Submodules:

Module contents:

This package runs the scheduler in a simulated environment, to evaluate various metrics. See Software Heritage Scheduler Simulator.

This module orchestrates of the simulator by initializing processes and connecting them together; these processes are defined in modules in the package and simulate/call specific components.

swh.scheduler.simulator.update_metrics_process(env: Environment, update_interval: int) Generator[Event, None, None][source]#

Update the scheduler metrics every update_interval (simulated) seconds, and add them to the SimulationReport

swh.scheduler.simulator.worker_process(env: Environment, name: str, task_queue: Queue, status_queue: Queue) Generator[Event, Task, None][source]#

A worker which consumes tasks from the input task_queue. Tasks themselves send OriginVisitStatus objects to the status_queue.

swh.scheduler.simulator.setup(env: Environment, scheduler_type: str, policy: str | None, workers_per_type: Dict[str, int], task_queue_capacity: int, min_batch_size: int, metrics_update_interval: int)[source]#
swh.scheduler.simulator.fill_test_data(scheduler: SchedulerInterface, num_origins: int = 100000)[source]#

Fills the database with mock data to test the simulator.

swh.scheduler.simulator.run(scheduler: SchedulerInterface, scheduler_type: str, policy: str | None, runtime: int | None)[source]#