etl_lib.core.ClosedLoopBatchProcessor module
- class ClosedLoopBatchProcessor(context, task, predecessor, expected_rows=None)[source]
Bases:
BatchProcessorReporting implementation of a BatchProcessor.
Meant to be the last entry in the list of
etl_lib.core.BatchProcessordriving the processing and reporting updates of the processed batches using theetl_lib.core.ProgressReporterfrom the context.- Parameters:
context (ETLContext)
task (Task)
predecessor (BatchProcessor)
expected_rows (int)
- __init__(context, task, predecessor, expected_rows=None)[source]
Constructs a new
etl_lib.core.BatchProcessorinstance.- Parameters:
context (
ETLContext) –etl_lib.core.ETLContext.ETLContextinstance. It Will be available to subclasses.task (
Task) –etl_lib.core.Task.Taskthis processor is part of. Needed for status reporting only.predecessor (
BatchProcessor) – Source of batches for this processor. Can be None if no predecessor is needed (such as when this processor is the start of the queue).expected_rows (int)
- get_batch(max_batch__size)[source]
Provides a batch of data to the caller.
The batch itself could be called and processed from the provided predecessor or generated from other sources.
- Parameters:
max_batch__size (
int) – The max size of the batch the caller expects to receive.- Return type:
- Returns
A generator that yields batches.