Skip to content

[azure-ai-projects] Add samples for dynamic and nested + dynamic pipelines - #17

Open
zzn2 wants to merge 5 commits into
feature/azure-ai-projects/training-prpr-2.2.0-pipelinesfrom
zhizhu-microsoft-dynamic-pipeline-samples
Open

zzn2 wants to merge 5 commits into
feature/azure-ai-projects/training-prpr-2.2.0-pipelinesfrom
zhizhu-microsoft-dynamic-pipeline-samples

Conversation

@zzn2

@zzn2 zzn2 commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Background

The azure.ai.projects.dsl samples under samples/jobs show pipelines whose graph is fully known at submission, including nested @pipeline composition in sample_pipeline_nested.py. The Foundry pipeline service also supports dynamic nodes, whose steps are decided while the job runs, and the SDK exposes them as @dynamic (added in #16). Customers have no example of authoring and submitting such a pipeline.

What this adds

A new samples/jobs/pipeline_dynamic folder:

  • steps/shards.py defines a source-backed process_shard @component and a @dynamic fan_out(shard_count, label) that adds one process_shard node per shard using shard_count.result(), the value resolved at runtime. It is import-safe because the dynamic node imports this module inside the job, where the submission-time environment variables do not exist.
  • sample_pipeline_dynamic.py submits a pipeline whose only step is the dynamic fan-out.
  • sample_pipeline_nested_dynamic.py puts a nested @pipeline subgraph (the fixed produce → normalize steps from the nested sample) and a top-level dynamic fan-out in the same parent pipeline.

Both scripts follow the existing pipeline samples: they read FOUNDRY_PROJECT_ENDPOINT, JOB_COMPUTE_ID, JOB_ENVIRONMENT_IMAGE, JOB_NODE_UAI_RESOURCE_ID and JOB_INSTANCE_TYPE, submit with client.pipeline_jobs.create_or_update(...), and print the job name, ID, status and, when returned, the portal URL. The nested-only case is not duplicated; it stays in sample_pipeline_nested.py.

flowchart LR
    P["workflow<br/>(@pipeline)"] --> N["text_subgraph<br/>(nested @pipeline)"]
    P --> D["fan_out<br/>(@dynamic)"]
    D -. "at runtime" .-> S0["process_shard 0"]
    D -. "at runtime" .-> S1["process_shard 1"]
Loading

Scope and prerequisites

  • The image must provide azure-ai-projects[dynamic] at the authoring version, and the user-assigned identity must be allowed to register components in the project; the docstrings say so.
  • The dynamic node is a direct child of the submitted pipeline, which is the shape the service has been shown to support. The samples do not place @dynamic inside a nested pipeline.

Dependencies

zzn2 and others added 5 commits December 4, 2026 01:32
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ode delegate

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@zzn2
zzn2 force-pushed the zhizhu-microsoft-dynamic-pipeline-samples branch from 6810d46 to 204ca04 Compare December 4, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant