Skip to content

Commit 2affda8

Browse files
authored
refactor(batch): remove legacy sqs_batch_processor (aws-powertools#1492)
1 parent 0678af2 commit 2affda8

File tree

8 files changed

+99
-908
lines changed

8 files changed

+99
-908
lines changed

aws_lambda_powertools/utilities/batch/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
batch_processor,
1414
)
1515
from aws_lambda_powertools.utilities.batch.exceptions import ExceptionInfo
16-
from aws_lambda_powertools.utilities.batch.sqs import PartialSQSProcessor, sqs_batch_processor
1716

1817
__all__ = (
1918
"BatchProcessor",
2019
"BasePartialProcessor",
2120
"ExceptionInfo",
2221
"EventType",
2322
"FailureResponse",
24-
"PartialSQSProcessor",
2523
"SuccessResponse",
2624
"batch_processor",
27-
"sqs_batch_processor",
2825
)

aws_lambda_powertools/utilities/batch/base.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,19 @@ def batch_processor(
170170
Lambda's Context
171171
record_handler: Callable
172172
Callable to process each record from the batch
173-
processor: PartialSQSProcessor
173+
processor: BasePartialProcessor
174174
Batch Processor to handle partial failure cases
175175
176176
Examples
177177
--------
178-
**Processes Lambda's event with PartialSQSProcessor**
178+
**Processes Lambda's event with a BasePartialProcessor**
179179
180-
>>> from aws_lambda_powertools.utilities.batch import batch_processor, PartialSQSProcessor
180+
>>> from aws_lambda_powertools.utilities.batch import batch_processor, BatchProcessor
181181
>>>
182182
>>> def record_handler(record):
183183
>>> return record["body"]
184184
>>>
185-
>>> @batch_processor(record_handler=record_handler, processor=PartialSQSProcessor())
185+
>>> @batch_processor(record_handler=record_handler, processor=BatchProcessor())
186186
>>> def handler(event, context):
187187
>>> return {"StatusCode": 200}
188188

aws_lambda_powertools/utilities/batch/exceptions.py

-13
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ def format_exceptions(self, parent_exception_str):
2424
return "\n".join(exception_list)
2525

2626

27-
class SQSBatchProcessingError(BaseBatchProcessingError):
28-
"""When at least one message within a batch could not be processed"""
29-
30-
def __init__(self, msg="", child_exceptions: Optional[List[ExceptionInfo]] = None):
31-
super().__init__(msg, child_exceptions)
32-
33-
# Overriding this method so we can output all child exception tracebacks when we raise this exception to prevent
34-
# errors being lost. See https://github.com/awslabs/aws-lambda-powertools-python/issues/275
35-
def __str__(self):
36-
parent_exception_str = super(SQSBatchProcessingError, self).__str__()
37-
return self.format_exceptions(parent_exception_str)
38-
39-
4027
class BatchProcessingError(BaseBatchProcessingError):
4128
"""When all batch records failed to be processed"""
4229

aws_lambda_powertools/utilities/batch/sqs.py

-250
This file was deleted.

0 commit comments

Comments
 (0)