Skip to main content

GetReplicaCount

Retrieves the replica count for a specific replica type from a map of replica specifications. If the replica type is not found or its replica count is not specified, it returns 0 as the default value.

def GetReplicaCount(
specs: map[kubeflowv1.ReplicaType]*kubeflowv1.ReplicaSpec,
replicaType: kubeflowv1.ReplicaType
) - > *int32

Retrieves the replica count for a specific replica type from a map of replica specifications. This function is used to determine the desired number of replicas for a given component within a Kubeflow setup, returning 0 if the replica type is not found or its replica count is not explicitly set.

Parameters

NameTypeDescription
specsmap[kubeflowv1.ReplicaType]*kubeflowv1.ReplicaSpecA map containing replica specifications, where the key is the replica type and the value is a pointer to the replica's specification details.
replicaTypekubeflowv1.ReplicaTypeThe specific type of replica for which to retrieve the count (e.g., 'Worker', 'Master').

Returns

TypeDescription
*int32A pointer to an integer representing the replica count for the specified replica type. Returns a pointer to 0 if the replica type is not found in the map or if its Replicas field is nil.