Skip to main content

ToReplicaSpecWithOverrides

Converts a kfDistributedReplicaSpec into a kubeflowv1.ReplicaSpec, applying overrides for resources, image, command, and restart policy. It also handles master replica specific configurations and resource sanitization.

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 containing details like replicas, image, resources, and restart policy.
primaryContainerNamestringThe name of the primary container within the replica spec to which overrides will be applied.
isMasterboolA boolean indicating whether this replica is the master. If true, the replica count will be forced to 1.

Returns

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