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: swh.scheduler.simulator.common.Environment, update_interval: int) Generator[simpy.events.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: swh.scheduler.simulator.common.Environment, name: str, task_queue: swh.scheduler.simulator.common.Queue, status_queue: swh.scheduler.simulator.common.Queue) Generator[simpy.events.Event, swh.scheduler.simulator.common.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: swh.scheduler.simulator.common.Environment, scheduler_type: str, policy: Optional[str], 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: swh.scheduler.interface.SchedulerInterface, num_origins: int = 100000)[source]

Fills the database with mock data to test the simulator.

swh.scheduler.simulator.run(scheduler: swh.scheduler.interface.SchedulerInterface, scheduler_type: str, policy: Optional[str], runtime: Optional[int])[source]