Repository navigation
Conversation
Add the types a distributed map run is built from: the source, processor, completion and destination config, the summary and result types, and the helpers a processor or reader Lambda calls in its handler.
Add ctx.distributedMap, which starts a distributed map run, waits for it to finish and returns its summary or per-item result. Builds on the distributed map config, result and helper types.
4 of 5 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
N/A
Description
This is the second of two PRs, and builds on the config, result and helper types in #889. It uses the new distributed map shapes in the Lambda model, so it can only merge once that model is released.
Adds the distributed map operation (
ctx.distributedMap) to the Java SDK:A map run processes a bounded dataset in parallel. A customer starts a map run from a durable function, naming a source to read items from, a processor function to invoke per batch, and concurrency, retry, and failure settings. The service reads items from the source, groups them into batches, invokes the processor for each batch, retries failures, tracks progress, routes successful results and failed items to destinations, and reports completion.
DurableContext.java,context/DurableContextImpl.javaThe customer-facing entry point on the durable context.
ctx.distributedMap: the method a customer calls to run a distributed map. Overloads that take a result type returnDistributedMapResult, and the others returnDistributedMapSummary.operation/DistributedMapOperation.javaThe operation that drives the run against the durable execution runtime.
throwIfError()opts into throwing.execution/CheckpointManager.javamodel/OperationSubType.java,operation/BaseDurableOperation.java,operation/ChildContextOperation.javaOperation type registration.
DISTRIBUTED_MAPtoOperationSubType, and passes a failed run's error to plugins.Future tasks
LocalDurableTestRunner(in the testing package). When this is done, we can add full end to end tests using the runner.Demo/Screenshots
N/A
Design
See Rules for every change.
+780lines insrc/mainand+1539insrc/test.ctx.distributedMapoverloads and theDISTRIBUTED_MAPvalue ofOperationSubType.Assumptions
Each assumption about the service, Lambda, the runtime or another library, with its evidence, or marked "unverified" (rule 6):
SUCCEEDED,FAILED,STOPPEDorTIMED_OUT. Unverified.DistributedMapDetailscarriesSuccessCount,FailureCountandReadCount, carriesTotalCountonce the run succeeded, and reports a run failure asErrorthere rather than as an operation-level error. Unverified.ResultscarriesItemIdand aStatusofSUCCEEDEDorFAILED, with the item's value inOutputas a string the customer's serdes decodes. Unverified.MaxRetryAttemptsof-1meaning unlimited attempts andMaxRetryDurationSecondsa whole number of seconds. Unverified.Decisions not covered by the issue or the design note
One line each, with the reason (rule 7):
"null", and a non-null value that serializes to null is rejected, because the service requires every item to be a string.ItemsandOutputare opaque strings, so a customer serdes other than JSON works without an SDK change.Checklist
Testing
Unit Tests
Have unit tests been written for these changes?
Yes. Tests are split by layer so each sits alongside its class.
operation/DistributedMapOperationTestandoperation/DistributedMapOperationTranslationTest: operation behaviour and the translation to and from the service shapes.context/DurableContextDistributedMapTest: thectx.distributedMapsurface.execution/CheckpointManagerTest: new tests for the size estimate. No existing test expectation was edited.Integration Tests
Have integration tests been written for these changes?
No.
LocalDurableTestRunnerdoes not support distributed map yet (see Future tasks).Examples
Has a new example been added for the change? (if applicable)
No. Examples will follow with runner support (see Future tasks).