pyrevs.runner

Submodules

Classes

RunnerConfig

Runner configuration.

BaseRunner

An ABC for the task runners.

Functions

make_runner(runner_cfg, worker_fn[, loglevel, ...]) → BaseRunner

Factory that instantiates a configured runner.

ms_worker(from_traj, rst_traj, min_val, new_weight, ...) → pyrevs.trajectory.Trajectory

A worker to restart trajectories.

pool_worker(traj, termination_criteria, end_date[, ...]) → pyrevs.trajectory.Trajectory

A worker to generate each initial trajectory.

Package Contents

class RunnerConfig[source]

Runner configuration.

type: str = 'asyncio'
nworkers: int = 1
dask_config: DaskConfig
class BaseRunner(runner_cfg: pyrevs.runner.config.RunnerConfig, worker_fn: collections.abc.Callable, n_workers: int = 1, loglevel: str = 'INFO', logfile: str | None = None)[source]

An ABC for the task runners.

abstractmethod make_promise(task: list[Any]) → None[source]

Log a new task to the list of task to tackle.

abstractmethod execute_promises() → Any[source]

Execute the list of promises.

abstractmethod n_workers() → int[source]

Return the number of workers in the runner.

make_runner(runner_cfg: pyrevs.runner.config.RunnerConfig, worker_fn: collections.abc.Callable, loglevel: str = 'INFO', logfile: str | None = None, max_workers: int = -1) → BaseRunner[source]

Factory that instantiates a configured runner.

Parameters:
  • runner_cfg – a config mapping for the runner

  • worker_fn – a worker function

  • loglevel – logging level

  • logfile – logging file

  • max_workers – maximum number of workers

ms_worker(from_traj: pyrevs.trajectory.Trajectory, rst_traj: pyrevs.trajectory.Trajectory, min_val: float, new_weight: float, termination_criteria: list[pyrevs.strategies.base.TerminationCriterion], end_date: datetime.date, trajdb_path: str | None = None, db_path: str | None = None) → pyrevs.trajectory.Trajectory[source]

A worker to restart trajectories.

Parameters:
  • from_traj – a trajectory to restart from

  • rst_traj – the trajectory being restarted

  • min_val – the value of the score function to restart from

  • new_weight – the weight of the new child trajectory

  • termination_criteria – a list of termination criterion for the advance call

  • end_date – the time limit to advance the trajectory

  • trajdb_path – a path to the SQL database

  • db_path – an optional path to the run database

pool_worker(traj: pyrevs.trajectory.Trajectory, termination_criteria: list[pyrevs.strategies.base.TerminationCriterion], end_date: datetime.date, trajdb_path: str | None = None, db_path: str | None = None) → pyrevs.trajectory.Trajectory[source]

A worker to generate each initial trajectory.

Parameters:
  • traj – a trajectory

  • termination_criteria – a list of termination criterion for the advance call

  • end_date – the time limit to advance the trajectory

  • trajdb_path – an optional path to the SQL database

  • db_path – an optional path to the run database

Returns:

The updated trajectory