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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the operation, used for cancellation and deadlines. |
| taskCtx | pluginsCore.TaskExecutionContext | The task execution context, providing access to task metadata and resources for applying overrides. |
| rs | kfDistributedReplicaSpec | The distributed replica specification, which can be a common replica spec or an individual replica spec, containing details like replicas, image, resources, and restart policy. |
| primaryContainerName | string | The name of the primary container within the replica, used to apply image and command overrides. |
| isMaster | bool | A boolean indicating whether this replica is the master. If true, the replica count will be set to 1. |
Returns
| Type | Description |
|---|---|
*kubeflowv1.ReplicaSpec, error | A Kubeflow ReplicaSpec with applied overrides or an error if conversion fails. |