pyrevs.runner.worker¶
A set of functions used by pyREVS workers.
Functions¶
|
Wrapper for update SQL trajectory info. |
|
Advance a trajectory with exception handling. |
|
A worker to generate each initial trajectory. |
|
A worker to restart trajectories. |
|
An async worker for the asyncio taskrunner. |
Module Contents¶
- update_trajectory_in_sql(traj: pyrevs.trajectory.Trajectory, trajdb: pyrevs.core.CoreDB | None = None, db_path: str | None = None) None[source]¶
Wrapper for update SQL trajectory info.
- Parameters:
trajdb – the SQL database to update
traj – the traj to get the information from
db_path – an optional pyREVS database path
- traj_advance_with_exception(traj: pyrevs.trajectory.Trajectory, termination_criteria: list[pyrevs.strategies.base.TerminationCriterion], walltime: float, trajdb: pyrevs.core.CoreDB | None = None, db_path: str | None = None) pyrevs.trajectory.Trajectory[source]¶
Advance a trajectory with exception handling.
- Parameters:
traj – a trajectory
termination_criteria – a list of termination criterion for the advance call
walltime – the time limit to advance the trajectory
trajdb – a handle to the SQL database
db_path – an optional path to the run database
- Returns:
The updated trajectory
- 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
- 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
- async worker_async(queue: asyncio.Queue[tuple[collections.abc.Callable[Ellipsis, Any], pyrevs.trajectory.Trajectory, float, bool, str]], res_queue: asyncio.Queue[asyncio.Future[pyrevs.trajectory.Trajectory]], executor: concurrent.futures.Executor) None[source]¶
An async worker for the asyncio taskrunner.
It wraps the call to one of the above worker functions with access to the queue.
- Parameters:
queue – a queue from which to get tasks
res_queue – a queue to put the results in
executor – an executor to launch the work in