Skip to main content

ToReplicaSpecWithOverrides

Converts a distributed replica specification into a Kubeflow ReplicaSpec, applying overrides for resources, image, command, and restart policy. It handles deprecated fields, normalizes GPU resource names, and ensures master replicas are set to one.

def ToReplicaSpecWithOverrides(
ctx: context.Context,
taskCtx: pluginsCore.TaskExecutionContext,
rs: kfDistributedReplicaSpec,
primaryContainerName: string,
isMaster: bool
) - > *kubeflowv1.ReplicaSpec, error

Converts a distributed replica specification into a Kubeflow ReplicaSpec, applying overrides for resources, image, and command. This function handles both common replica specifications and individual replica specifications, ensuring that resource requirements are sanitized and master replicas are correctly configured.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for cancellation and deadlines.
taskCtxpluginsCore.TaskExecutionContextThe task execution context, providing access to task metadata and resources for applying overrides.
rskfDistributedReplicaSpecThe distributed replica specification, which can be a common replica spec or an individual replica spec, containing details like replicas, image, resources, and restart policy.
primaryContainerNamestringThe name of the primary container within the replica, used to apply image and command overrides.
isMasterboolA boolean indicating whether this replica is the master. If true, the replica count will be set to 1.

Returns

TypeDescription
*kubeflowv1.ReplicaSpec, errorA Kubeflow ReplicaSpec with applied overrides or an error if conversion fails.