Dynamic Submission
Shows dynamic sub-task submission: a worker splits a summation problem into threshold-sized chunks, submits one sub-task per chunk, and then submits an aggregation task to sum the partial results.
What it does
The client builds a
Tablecontaining the sequence[1, 2, …, n], uploads it as a payload, and submits a single root task.The root task checks whether the table is larger than the threshold:
If yes: splits the table into
⌈size / threshold⌉sub-tables, submits one sub-task per chunk, then submits an aggregation task that declares all partial-result IDs as data dependencies.If no (leaf task or aggregation task): sums the values directly, or sums the data-dependency results if dependencies are present, and writes the final
uintresult.
The client verifies the result equals
n*(n+1)/2and prints it.
The Table payload (defined in Common/Payload.cs) is JSON-serialised and shared between client and worker.
Project structure
DynamicSubmission/
├── Common/
│ └── Payload.cs # Table record: Size, Threshold, Values[], Serialize/Deserialize
├── Client/
│ └── Program.cs # Builds Table payload, submits root task, validates result
└── Worker/
├── Program.cs # Worker entry point
└── DynamicSubmission.cs # WorkerStreamWrapper with split/aggregate logic
Key concepts
Shared payload type (
Table) used by both client and workerWorker dynamically partitioning work and spawning sub-tasks at runtime
Aggregation task using
DataDependenciesto collect partial resultstaskHandler.CreateResultsMetaDataAsyncandtaskHandler.SubmitTasksAsyncfor bulk sub-task creation
Running
Client
dotnet run --project Client -- \
--endpoint http://localhost:5001 \
--partition default \
--n 10 \
--threshold 3
Option |
Default |
Description |
|---|---|---|
|
|
ArmoniK control plane URL |
|
|
Partition to submit tasks to |
|
|
Compute the sum |
|
|
Chunk size before splitting into sub-tasks |
Worker
dotnet run --project Worker
The worker reads its gRPC endpoint from environment variables (standard ArmoniK worker configuration).