-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: New batch processing option: 'ThrowOnFullBatchFailure' #646
feat: New batch processing option: 'ThrowOnFullBatchFailure' #646
Conversation
…ol if a BatchProcessingException should be raised on full batch failure or not.
@lachriz-aws thank you for opening the pull request. There are two small issues raised by SonarCloud. https://sonarcloud.io/project/issues?sinceLeakPeriod=true&issueStatuses=OPEN%2CCONFIRMED&pullRequest=646&id=aws-powertools_powertools-lambda-dotnet&open=AZILxhrgZTYLizOkweVb. Can you address them please? thank you |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #646 +/- ##
===========================================
+ Coverage 72.71% 73.01% +0.30%
===========================================
Files 190 195 +5
Lines 7886 7998 +112
Branches 850 854 +4
===========================================
+ Hits 5734 5840 +106
- Misses 1862 1873 +11
+ Partials 290 285 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…the <summary> of the BatchProcessorAttribute.
Yes, absolutely. Now done. When time allows, please let me know what you think of the proposed solution and I will be happy to get going updating the docs as well. Thank you :) |
@hjgraca The docs are now updated as well and the changes have been pushed to the feature branch for this PR :) |
Quality Gate passedIssues Measures |
Added new batch processing option:
ThrowOnFullBatchFailure
to control if aBatchProcessingException
should be raised on full batch failure or not.Issue number: #608
Summary
Changes
This PR introduces a new batch processing option:
ThrowOnFullBatchFailure
to control if aBatchProcessingException
should be raised on full batch failure or not.The processing option can be set via:
ThrowOnFullBatchFailure
field on theBatchProcessor
attribute (applied in non-utility mode).POWERTOOLS_BATCH_THROW_ON_FULL_BATCH_FAILURE
(applied in non-utility mode).AWS.Lambda.Powertools.BatchProcessing.ProcessingOptions
in utility mode.To maintain current behavior, the new setting defaults to
true
, but as pointed out on a similar feature request in the Powertools for AWS Lambda (TypeScript) repo, here: aws-powertools/powertools-lambda-typescript#2122 we might want to change that for the next major version release.To maintain feature parity, the new setting has been named similar to how it has been implemented in Powertools for AWS Lambda (TypeScript), see: https://github.com/arnabrahman/aws-lambda-powertools-typescript/blob/main/packages/batch/src/types.ts#L32
User experience
Imagine a scenario where processing of an entire batch has failed: if
ThrowOnFullBatchFailure
is set tofalse
then the Batch Processor will not throw an exception after batch processing has completed. Instead, it will simply return the ids of the items that failed processing (all batch items in this case) and exit gracefully.In the scenario that a Lambda function is configured with
ErrorHandlingPolicy = StopOnFirstBatchItemFailure
and the first batch item fails processing, then the entire batch is marked as failed (as per the docs: https://docs.powertools.aws.dev/lambda/dotnet/utilities/batch-processing/#error-handling-policy). In this case, ifThrowOnFullBatchFailure
is set tofalse
, then the same behavior as outlined above will apply (in other words, the newThrowOnFullBatchFailure
option is compatible with the different error handling policies we have today).Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change? No
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.