Batch

Batch module.

class miscore.tools.batch.Task(model, **kwargs)[source]

A task holds a model, together with the parameters that should be used to run the model with.

Parameters:
  • model (Model) – The model to be run.

  • kwargs – All other keyword arguments will be passed to the run() method of the model.

miscore.tools.batch.run(tasks, processes=None, chunksize=1)[source]

Executes tasks in parallel. After completion, the ‘result’ attribute of each task refers to the corresponding result.

Parameters:
  • tasks (Sequence[Task]) – The tasks to be executed.

  • processes (int | None) – The number of processes to distribute the tasks over. Defaults to the number of CPU cores detected.

  • chunksize (int) – The chunk size of the batch.