CalculationBackend

class openff.evaluator.backends.CalculationBackend(number_of_workers=1, resources_per_worker=None)[source]

An abstract base representation of an openff-evaluator calculation backend. A backend is responsible for coordinating, distributing and running calculations on the available hardware. This may range from a single machine to a multinode cluster, but not across multiple cluster or physical locations.

Notes

All estimator backend classes must inherit from this class, and must implement the start, stop, and submit_task method.

__init__(number_of_workers=1, resources_per_worker=None)[source]

Constructs a new CalculationBackend object.

Parameters
  • number_of_workers (int) – The number of works to run the calculations on. One worker can perform a single task (e.g run a simulation) at once.

  • resources_per_worker (ComputeResources, optional) – The number of resources to request per worker.

Methods

__init__([number_of_workers, ...])

Constructs a new CalculationBackend object.

start()

Start the calculation backend.

stop()

Stop the calculation backend.

submit_task(function, *args, **kwargs)

Submit a task to the compute resources managed by this backend.

Attributes

started

Returns whether this backend has been started yet.

property started

Returns whether this backend has been started yet.

Type

bool

start()[source]

Start the calculation backend.

abstract stop()[source]

Stop the calculation backend.

abstract submit_task(function, *args, **kwargs)[source]

Submit a task to the compute resources managed by this backend.

Parameters

function (function) – The function to run.

Returns

Returns a future object which will eventually point to the results of the submitted task.

Return type

Future