testutil

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestImageName      = "test-image-for-kubeflow-pytorch-operator:latest"
	TestPyTorchJobName = "test-pytorchjob"
	LabelWorker        = "worker"
	LabelMaster        = "master"

	SleepInterval = 500 * time.Millisecond
	ThreadCount   = 1
)
View Source
const (
	LabelGroupName      = "group-name"
	LabelPyTorchJobName = "pytorch-job-name"
)

Variables

View Source
var (
	// KeyFunc is the short name to DeletionHandlingMetaNamespaceKeyFunc.
	// IndexerInformer uses a delta queue, therefore for deletes we have to use this
	// key function but it should be just fine for non delete events.
	KeyFunc   = cache.DeletionHandlingMetaNamespaceKeyFunc
	GroupName = pyv1.GroupName
)
View Source
var (
	AlwaysReady = func() bool { return true }
)

Functions

func CheckCondition

func CheckCondition(job *pyv1.PyTorchJob, condition common.JobConditionType, reason string) bool

func ConvertPyTorchJobToUnstructured

func ConvertPyTorchJobToUnstructured(job *pyv1.PyTorchJob) (*unstructured.Unstructured, error)

ConvertPyTorchJobToUnstructured uses JSON to convert PyTorchJob to Unstructured.

func GenLabels

func GenLabels(jobName string) map[string]string

func GenOwnerReference

func GenOwnerReference(job *pyv1.PyTorchJob) *metav1.OwnerReference

func GetKey

func GetKey(job *pyv1.PyTorchJob, t *testing.T) string

func NewBasePod

func NewBasePod(name string, job *pyv1.PyTorchJob, t *testing.T) *v1.Pod

func NewBaseService

func NewBaseService(name string, job *pyv1.PyTorchJob, t *testing.T) *v1.Service

func NewPod

func NewPod(job *pyv1.PyTorchJob, typ string, index int, t *testing.T) *v1.Pod

func NewPodList

func NewPodList(count int32, status v1.PodPhase, job *pyv1.PyTorchJob, typ string, start int32, t *testing.T) []*v1.Pod

create count pods with the given phase for the given job

func NewPyTorchJob

func NewPyTorchJob(worker int) *pyv1.PyTorchJob

func NewPyTorchJobWithActiveDeadlineSeconds

func NewPyTorchJobWithActiveDeadlineSeconds(master, worker int, ads *int64) *pyv1.PyTorchJob

func NewPyTorchJobWithBackoffLimit

func NewPyTorchJobWithBackoffLimit(master, worker int, backoffLimit *int32) *pyv1.PyTorchJob

func NewPyTorchJobWithCleanPolicy

func NewPyTorchJobWithCleanPolicy(master, worker int, policy common.CleanPodPolicy) *pyv1.PyTorchJob

func NewPyTorchJobWithCleanupJobDelay

func NewPyTorchJobWithCleanupJobDelay(master, worker int, ttl *int32) *pyv1.PyTorchJob

func NewPyTorchJobWithMaster

func NewPyTorchJobWithMaster(worker int) *pyv1.PyTorchJob

func NewPyTorchReplicaSpecTemplate

func NewPyTorchReplicaSpecTemplate() v1.PodTemplateSpec

func NewService

func NewService(job *pyv1.PyTorchJob, typ string, index int, t *testing.T) *v1.Service

func NewServiceList

func NewServiceList(count int32, job *pyv1.PyTorchJob, typ string, t *testing.T) []*v1.Service

NewServiceList creates count pods with the given phase for the given job

func SetPodsStatuses

func SetPodsStatuses(podIndexer cache.Indexer, job *pyv1.PyTorchJob, typ string, pendingPods, activePods, succeededPods, failedPods int32, restartCounts []int32, t *testing.T)

func SetPyTorchJobCompletionTime

func SetPyTorchJobCompletionTime(job *pyv1.PyTorchJob)

func SetServices

func SetServices(serviceIndexer cache.Indexer, job *pyv1.PyTorchJob, typ string, activeWorkerServices int32, t *testing.T)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL