drugex.parallel package
Submodules
drugex.parallel.collectors module
collectors
Created by: Martin Sicho On: 14.07.22, 10:58
- class drugex.parallel.collectors.ListAppend[source]
Bases:
ListExtend
- class drugex.parallel.collectors.ListExtend[source]
Bases:
ListCollector
drugex.parallel.evaluator module
evaluator
Created by: Martin Sicho On: 29.05.22, 18:12
- class drugex.parallel.evaluator.ParallelSupplierEvaluator(supplier_class, n_proc=None, chunk_size=1000, chunks=None, args=None, kwargs=None)[source]
Bases:
ParallelProcessor
Class implementing parallel evaluation of
MolSupplier
instances on input data (seeParallelSupplierEvaluator.apply
).- apply(data, collector, error=None, desc_string=None)[source]
Apply the
ParallelSupplierEvaluator.run()
across aPool
of workers.- Parameters:
data – input data to divide into chunks and process in parallel
collector – a
ResultCollector
that receives results of parallel processeserror – a callable to handle errors during evaluation of each parallel supplier
desc_string – progress bar description string
- Returns:
- error(data)[source]
Catch and log an error occurring in the parallel process.
- Raises:
- Parameters:
data – error data
- initSupplier(supplier_class, chunk)[source]
Initialize a
MolSupplier
instance on the given chung of data. :param supplier_class:MolSupplier
to initialize. :param chunk: Data chunk.- Returns:
initialized
MolSupplier
- run(chunk, error)[source]
Initialize and start evaluation of the
MolSupplier
instance on the given chunk of data.- Parameters:
chunk – Current chunk of data.
- Returns:
result of the
MolSupplier.toList()
method for the given chunk.
drugex.parallel.interfaces module
interfaces
Created by: Martin Sicho On: 29.05.22, 18:09
- class drugex.parallel.interfaces.ListCollector[source]
Bases:
ResultCollector
,ABC
- class drugex.parallel.interfaces.ParallelProcessor(n_proc=None, chunk_size=1000, chunks=None)[source]
Bases:
ABC
Simple interface to define parameters for parallel processing of data.
- abstract apply(data, collector)[source]
Apply the processor to the given data.
- Parameters:
data – input data (format depends on the implementation)
collector – a
ResultCollector
that is used to collect data produced from each process.
- Returns:
None
.
drugex.parallel.tests module
tests
Created by: Martin Sicho On: 12.04.22, 15:07
Module contents
__init__.py
Created by: Martin Sicho On: 29.05.22, 18:09