Repository navigation
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
zzn2
force-pushed
the
zhizhu-microsoft-sdk-dynamic-pipelines
branch
from
December 4, 2026 09:33
75742c9 to
8a5ad0e
Compare
…ode delegate Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Background
The
azure.ai.projects.dslmodule can author Foundry pipelines with@componentand@pipeline, including nested pipelines, but every graph must be fully known at submission time. Many training workflows only know their shape once the job runs: the number of shards comes from a data scan, the set of evaluations depends on an earlier step, and so on. The Foundry pipeline service already supports this through dynamic Command nodes, which compile a subgraph at runtime that the service then expands in place. Until now, authoring such nodes required mldesigner and thereforeazure-ai-mlinside the job image.This PR adds
azure.ai.projects.dsl.dynamic, a decorator that defines a dynamic node directly in the project SDK, together with a small runtime executor that compiles and registers the subgraph without mldesigner orazure-ai-ml.How it works
sequenceDiagram participant SDK as Client SDK<br/>(@pipeline / @dynamic) participant Svc as Foundry pipeline service participant Node as Dynamic node<br/>(azure.ai.projects._dynamic_executor) participant Proj as Foundry project APIs participant RH as Run history (via MLflow) SDK->>Proj: register Command component<br/>properties azureml.pipelines.dynamic=true SDK->>Svc: submit PipelineJob Svc->>Node: run node with resolved inputs Node->>Node: call user function, collect created nodes Node->>Proj: upload code, register Pipeline component mldyn-hash/1 Node->>RH: PATCH run property<br/>azureml.pipelines.dynamicSubPipelineComponentId Svc->>Svc: expand registered subgraph in place of the nodeAuthoring.
@dynamicis always source-backed, like a source@component: the function's code root is snapshotted and uploaded. The node's command ispython -m azure.ai.projects._dynamic_executor <settings> <module> <function> <inputs...>, where<settings>is a URL-safe base64 JSON of the enclosing pipeline's compute, image, identity and instance type, so nodes created at runtime inherit them. The component carries the propertyazureml.pipelines.dynamic: "true"; registration of top-level Command components (from #14) now forwards component properties into the registered resource'spropertiesas well, since that is where the service reads the marker.Runtime. The executor imports the user function, passes each input as an input reference whose
.result()returns the resolved value (so Python control flow can depend on it), and records every@componentcall as a node of a new Pipeline component whose inputs mirror the dynamic node's inputs (${{parent.inputs.x}}bindings are preserved). It uploads code through the sameclient.beta.jobscode-resolution path used at submission, registers the Pipeline component under a run- and content-derived name (mldyn-<hash>, version1, anonymous,client_component_hashproperty,Foundry-Features: Jobs=V1Preview), and writes the component ID to the node's run asazureml.pipelines.dynamicSubPipelineComponentId. The service reads that property after the node completes and expands the subgraph.Design note
Ported from mldesigner: the decorator contract (marker property, input references with
.result()), runtime invocation of the user function to collect nodes, content-hashed anonymous Pipeline component registration against the Foundry project endpoint derived fromAZUREML_ARM_WORKSPACE_NAME(<account>@<project>@AML), and the RunHistory write. Left in mldesigner: mldesigner's own component model andmldesigner executeCLI, AML workspace (non-Foundry) registration, environment objects other than an image, dynamic outputs and output validation, and anyazure-ai-mlinterop. The executor reuses the existing DSL (_PipelineContext,_component_ports,_CONVERSIONS) rather than adding a second component model.Backend contract. The marker property, the RunHistory key, the
mldyn-naming and the generated interface shape (inputs matching the dynamic node, no outputs) follow the contract the Foundry pipeline service consumes today, as exercised by a completed Foundry project dynamic job whose compiler registeredmldyn-<hash>/1and whose two expanded child runs completed.Identity and registration. The executor authenticates to the project with the job's user-assigned managed identity (
DEFAULT_IDENTITY_CLIENT_ID) viaManagedIdentityCredential, so that identity needs permission to upload data and register components in the project.RunHistory write and the
dynamicextra. The project SDK has no RunHistory client, and the job platform already hands each run MLflow tracking credentials (MLFLOW_TRACKING_URI/ token). The executor therefore uses MLflow's host credentials, rewrites the tracking host frommlflow/v2.0tohistory/v1.0, and PATCHes/experimentids/{exp}/runs/{run}with the property, the same route mldesigner uses. Tokens are never read into the SDK or logged. Because only the job image needs this,mlflow-skinnyandazureml-mlfloware declared as a new optional extra,azure-ai-projects[dynamic], rather than hard dependencies; a missing install raises anImportErrornaming the extra.Scope and limitations
@component(Command) nodes; they cannot declare outputs, return values, or create nested pipelines.@pipelineis not registered with the marker by the current registration flow and has not been validated end to end with the service.@pipeline.azure-ai-projectswith thedynamicextra.AZUREML_RUN_ID(for example, when run locally), the executor prints the compiled spec instead of registering it.Dependencies
This builds on pipeline work already merged into the integration branch:
@pipeline)pipeline_jobsvia/jobs)Customer samples using
@pipelineand@dynamicfollow in a separate PR.