Multiple Results
Shows how a single task can produce multiple results in ArmoniK.
What it does
The client creates a session, pre-allocates N result slots (controlled by --nResultsPerTask), uploads an input string as the payload, submits one task that is expected to fill all N results, waits for all of them, then prints each one.
The worker iterates over every result ID it is expected to produce and writes "<input> World_ <resultId>" to each one.
Project structure
MultipleResults/
├── Client/
│ └── Program.cs # Session creation, multi-result task submission, result download loop
└── Worker/
├── Program.cs # Worker entry point
└── MultipleResultsWorker.cs # WorkerStreamWrapper iterating over ExpectedResults
Key concepts
Pre-allocating multiple result IDs before task submission with
CreateResultsMetaDataPassing multiple IDs in
ExpectedOutputKeyswhen submitting a single taskWorker iterating over
taskHandler.ExpectedResultsto produce N outputsWaiting for a list of results with
EventsClient.WaitForResultsAsync
Running
Client
dotnet run --project Client -- \
--endpoint http://localhost:5001 \
--partition default \
--input "Hello" \
--nResultsPerTask 10
Option |
Default |
Description |
|---|---|---|
|
|
ArmoniK control plane URL |
|
|
Partition to submit tasks to |
|
|
Input string sent as payload |
|
|
Number of results the single task must produce |
Worker
dotnet run --project Worker
The worker reads its gRPC endpoint from environment variables (standard ArmoniK worker configuration).