feat(convention): Implement convention to render cpp workers compatible with other sdk clients#76
Open
jfonseca-aneo wants to merge 43 commits into
Open
feat(convention): Implement convention to render cpp workers compatible with other sdk clients#76jfonseca-aneo wants to merge 43 commits into
jfonseca-aneo wants to merge 43 commits into
Conversation
dd41e5c to
644556c
Compare
This was referenced Apr 7, 2026
aneojgurhem
reviewed
Apr 28, 2026
Contributor
lemaitre-aneo
left a comment
There was a problem hiding this comment.
The new payload definition relies on the fact that that results with the inputs are already present and known to the user, but from a user perspective, it would be much easier to have an interface where a user can just say I call this method with this raw data and let the library uploads its data for them.
dfeef31 to
672c596
Compare
1da1e8f to
c7d22f6
Compare
37cb1ad to
4b0b619
Compare
- ConventionPayload should not be in the public API - Make HandleResponse more backwards compatible friendly
4b0b619 to
514e0bf
Compare
514e0bf to
aed99ed
Compare
2a4aded to
1418cc3
Compare
lemaitre-aneo
approved these changes
May 13, 2026
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.
Summary
This PR implements the task options convention for the C++ SDK, enabling interoperability with other ArmoniK SDK clients. It adds a new execution path in the
DynamicWorkeralongside the existing legacy path, extends the client to submit convention-encoded tasks and upload shared libraries as blobs, and introduces aTaskDefinitionAPI that handles blob (task inputs) upload automatically.Context: Convention definition
The convention is an agreed encoding that allows a client written on top of any the supported SDKs to submit tasks to a worker written on top of any of the supported SDKs (Java, C#). In concrete terms:
ConventionVersion,LibraryPath,LibraryBlobId,Symbol— carried in the flatTaskOptions.optionsmap, following the same keys used by the C# and Java SDKs.{"inputs":{...},"outputs":{...}}replacing the C++-specific binary encoding for convention tasks.The
DynamicWorkerselects the path at runtime: presence ofConventionVersionin task options triggers the convention path; its absence falls through to the unchanged legacy path.Context: Blobs
A blob is a named, immutable byte sequence stored in ArmoniK's result storage and identified by a UUID. The concept and the terminology are borrowed from the C# and Java SDKs, where blobs are the standard unit for passing data between clients and workers. In the convention path, task inputs and the worker library are all transmitted as blobs: the client uploads them before submission, lists their IDs in
data_dependencies, and the worker downloads them at execution time. This is in contrast to the legacy C++ path, where the payload is embedded directly in the task submission request.Main changes
ArmoniK.SDK.Common: newDynamicLibrarystruct with convention key constants;TaskPayload(the legacy binary format) is marked[[deprecated]]— useTaskDefinitionwithSubmit(vector<TaskDefinition>)instead; an internalConventionPayloadstruct carries the JSON wire format for the convention path — it lives inarmonik/sdk/common/internal/ConventionPayload.hand is not part of the public API;TaskOptionsgainsSetDynamicLibrary/GetDynamicLibrary/GetConventionVersionhelpers.ArmoniK.SDK.DynamicWorker: convention path added toDynamicWorker::Execute()— handles blob-based library loading, method name fallback from task options, and transparent input blob resolution.ApplicationManagergainsUseLibrary()for loading a.sodirectly by path with a configurable symbol prefix.ArmoniK.SDK.Client: newUploadLibrary(path, lib)that uploads a.soas a blob and setslib.library_blob_idin-place (like in the new C# SDK).TaskDefinition/BlobDefinition(new user-facing API): callers no longer need to pre-allocate result IDs or upload blobs manually.BlobDefinition::FromData(bytes)provides raw data to be uploaded on submission;BlobDefinition::FromBlobId(id)references an already-uploaded blob.Submit(TaskDefinition)uploads all raw inputs in batches (reusing the existing batcher and thread pool), wires them intodata_dependenciesso the DynamicWorker can resolve them, and then follows the existing submission path.IServiceInvocationHandler:HandleResponsegains a backward-compatible three-parameter overload that addsresult_id(the blob ID of the completed task's result). The default implementation of the three-parameter version delegates to the existing two-parameter one, so existing handlers compile and run without changes. Override the three-parameter version to accessresult_idand pass it toBlobDefinition::FromBlobIdto chain tasks without re-uploading.ArmoniK.SDK.Worker:ServiceBasegains a map-basedcall(session_ctx, name, inputs)overload for the convention path. The string-basedcall()is no longer pure virtual — its default implementation parses the convention JSON payload and delegates to the map overload, so existing legacy workers that override the string version are unaffected. Convention workers override the map overload and receive named inputs directly without any JSON parsing.ArmoniK.SDK.Worker.Test: newConventionServiceimplementingsquareandaddby overriding the map-basedcall()overload, registered under theConventionArithmeticservice name.New dependency: JSON serialization is managed by nlohmann-json so this dependency was added to all Dockerfiles and the Debian package build-depends. For the RHEL Dockerfile the dependency is built in place. The dependency is declared
PRIVATEinArmoniK.SDK.CommonandArmoniK.SDK.Client.ArmoniK.SDK.Workeruses it for theServiceBasedefault dispatch via include-path injection (not a link dependency), so it does not appear in the exported cmake targets and does not leak to downstream consumers.Tests: new
SerializationTest.cppwith unit tests forTaskOptionsconvention helpers (BlobDefinition×5,TaskDefinition×4); added four tests toArmoniK.SDK.Client.Test.cppcovering convention task submission, method name fallback, and task chaining. End-to-end tests inSessionHandlingTest.cppcoverSubmit(TaskDefinition)for single raw input, batch submission, and no-input tasks. The chaining test (testConventionChainedSquareThenAdd) computes2² + 3² = 13using three tasks, feeding the result blob IDs of the first two directly into the third viaBlobDefinition::FromBlobId.Backward compatibility
The legacy execution path (
application_name/application_version+ binary payload) is unchanged. All existing tests continue to use it. The convention is opt-in: theDynamicWorkerselects the path based on the presence ofConventionVersionin task options. The legacy path (Submit(TaskPayload)) is deprecated —TaskPayloadcarries[[deprecated]]and compilers will warn at call sites.HandleResponseis extended with a backward-compatible three-parameter overload; existing two-parameter implementations continue to work without modification. UseSubmit(TaskDefinition)for new code.Java sample
Check aneoconsulting/ArmoniK.Samples#172 for a Java Sample sending tasks to a Cpp worker
C# sample
Check aneoconsulting/ArmoniK.Samples#173 for a C# Sample sending tasks to a Cpp worker