util

package
v1.4.7-rc6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package util provides various helper routines.

Index

Constants

View Source
const (
	// JobCreatedReason is added in a job when it is created.
	JobCreatedReason = "JobCreated"
	// JobSucceededReason is added in a job when it is succeeded.
	JobSucceededReason = "JobSucceeded"
	// JobRunningReason is added in a job when it is running.
	JobRunningReason = "JobRunning"
	// JobFailedReason is added in a job when it is failed.
	JobFailedReason = "JobFailed"
	// JobRestartingReason is added in a job when it is restarting.
	JobRestartingReason = "JobRestarting"
	// JobFailedValidationReason is added in a job when it failed validation
	JobFailedValidationReason = "JobFailedValidation"
)
View Source
const (
	// EnvKubeflowNamespace is a environment variable for namespace when deployed on kubernetes
	EnvKubeflowNamespace = "KUBEFLOW_NAMESPACE"
)

Variables

This section is empty.

Functions

func IsFailed

func IsFailed(status apiv1.JobStatus) bool

IsFailed checks if the job is failed

func IsSucceeded

func IsSucceeded(status apiv1.JobStatus) bool

IsSucceeded checks if the job is succeeded

func LoggerForJob

func LoggerForJob(job metav1.Object) *log.Entry

func LoggerForKey

func LoggerForKey(key string) *log.Entry

func LoggerForPod

func LoggerForPod(pod *v1.Pod, kind string) *log.Entry

func LoggerForReplica

func LoggerForReplica(job metav1.Object, rtype string) *log.Entry

func LoggerForService

func LoggerForService(svc *v1.Service, kind string) *log.Entry

func LoggerForUnstructured

func LoggerForUnstructured(obj *metav1unstructured.Unstructured, kind string) *log.Entry

func Pformat

func Pformat(value interface{}) string

Pformat returns a pretty format output of any value that can be marshaled to JSON.

func RandString

func RandString(n int) string

RandString generates a random string of the desired length.

The string is DNS-1035 label compliant; i.e. its only alphanumeric lowercase. From: https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang

func UpdateJobConditions

func UpdateJobConditions(jobStatus *apiv1.JobStatus, conditionType apiv1.JobConditionType, reason, message string) error

UpdateJobConditions adds to the jobStatus a new condition if needed, with the conditionType, reason, and message

Types

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter() *Counter

func (*Counter) Counts

func (c *Counter) Counts(key string) (int, error)

func (*Counter) Dec

func (c *Counter) Dec(key string) error

func (*Counter) DeleteKey

func (c *Counter) DeleteKey(key string)

func (*Counter) Inc

func (c *Counter) Inc(key string)

Directories

Path Synopsis
Package that various helper routines for training.
Package that various helper routines for training.

Jump to

Keyboard shortcuts

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