@@ -29,11 +29,10 @@ class OnDemandSandboxWorkerProfileOptions:
2929 """Options for a decorated on-demand sandbox worker profile."""
3030
3131 worker_profile_id : str
32+ # Full OCI image reference for the sandbox worker container, for example
33+ # "myregistry.azurecr.io/workers/hello:1.0" or
34+ # "myregistry.azurecr.io/workers/hello@sha256:0123456789abcdef...".
3235 container_image : Optional [str ] = None
33- registry_server : Optional [str ] = None
34- repository : Optional [str ] = None
35- tag : Optional [str ] = None
36- image_digest : Optional [str ] = None
3736 image_pull_managed_identity_client_id : Optional [str ] = None
3837 scheduler_managed_identity_client_id : Optional [str ] = None
3938 cpu : str = DEFAULT_CPU
@@ -97,49 +96,26 @@ def resolve_activity_names(activity_names: str | Iterable[str]) -> list[str]:
9796 return resolved
9897
9998
100- def build_image_ref (
101- * ,
102- container_image : Optional [str ] = None ,
103- registry_server : Optional [str ] = None ,
104- repository : Optional [str ] = None ,
105- tag : Optional [str ] = None ,
106- image_digest : Optional [str ] = None ) -> Optional [str ]:
107- if container_image and container_image .strip ():
108- return container_image .strip ()
109-
110- if not repository or not repository .strip ():
111- return None
112-
113- image = repository .strip ()
114- if registry_server and registry_server .strip ():
115- image = f"{ registry_server .strip ()} /{ image } "
116-
117- if image_digest and image_digest .strip ():
118- return f"{ image } @{ image_digest .strip ()} "
119-
120- if tag and tag .strip ():
121- return f"{ image } :{ tag .strip ()} "
122-
123- return image
124-
125-
12699def build_on_demand_sandbox_activity_declaration (
127100 * ,
128101 activity_names : str | Iterable [str ],
129102 scheduler_managed_identity_client_id : str ,
130103 worker_profile_id : str = DEFAULT_WORKER_PROFILE_ID ,
131104 container_image : Optional [str ] = None ,
132- registry_server : Optional [str ] = None ,
133- repository : Optional [str ] = None ,
134- tag : Optional [str ] = None ,
135- image_digest : Optional [str ] = None ,
136105 image_pull_managed_identity_client_id : Optional [str ] = None ,
137106 cpu : str = DEFAULT_CPU ,
138107 memory : str = DEFAULT_MEMORY ,
139108 environment_variables : Optional [dict [str , str ]] = None ,
140109 max_concurrent_activities : int = DEFAULT_MAX_CONCURRENT_ACTIVITIES ,
141110 entrypoint : Optional [Iterable [str ]] = None ,
142111 cmd : Optional [Iterable [str ]] = None ) -> pb .OnDemandSandboxActivityDeclaration :
112+ """Build a sandbox activity declaration.
113+
114+ Args:
115+ container_image: Full OCI image reference for the sandbox worker container,
116+ such as "myregistry.azurecr.io/workers/hello:1.0" or
117+ "myregistry.azurecr.io/workers/hello@sha256:0123456789abcdef...".
118+ """
143119 resolved_activity_names = resolve_activity_names (activity_names )
144120 if not resolved_activity_names :
145121 raise ValueError ("On-demand sandbox activity declaration requires at least one activity name." )
@@ -150,14 +126,11 @@ def build_on_demand_sandbox_activity_declaration(
150126 if max_concurrent_activities <= 0 :
151127 raise ValueError ("On-demand sandbox activity max concurrent activities must be greater than zero." )
152128
153- image_ref = build_image_ref (
154- container_image = container_image ,
155- registry_server = registry_server ,
156- repository = repository ,
157- tag = tag ,
158- image_digest = image_digest )
159- if not image_ref :
160- raise ValueError ("On-demand sandbox activity image metadata requires a container image reference." )
129+ image_ref = _normalize_required (
130+ container_image ,
131+ "On-demand sandbox activity image metadata requires a container image reference like "
132+ "'myregistry.azurecr.io/workers/hello:1.0' or "
133+ "'myregistry.azurecr.io/workers/hello@sha256:...'." )
161134
162135 resolved_scheduler_managed_identity_client_id = _normalize_required (
163136 scheduler_managed_identity_client_id ,
@@ -207,10 +180,6 @@ def build_profile_on_demand_sandbox_activity_declarations() -> list[pb.OnDemandS
207180 activity_names = activity_names ,
208181 worker_profile_id = profile .worker_profile_id ,
209182 container_image = profile .container_image ,
210- registry_server = profile .registry_server ,
211- repository = profile .repository ,
212- tag = profile .tag ,
213- image_digest = profile .image_digest ,
214183 image_pull_managed_identity_client_id = profile .image_pull_managed_identity_client_id ,
215184 scheduler_managed_identity_client_id = profile .scheduler_managed_identity_client_id ,
216185 cpu = profile .cpu ,
0 commit comments