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 a pointer to an int32 with a default value of 0.

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 Kubeflow replica type and the value is a pointer to the ReplicaSpec object.
replicaTypekubeflowv1.ReplicaTypeThe specific Kubeflow replica type for which to retrieve the replica count.

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 or the replica count is not specified.