Documentation ¶
Overview ¶
Package util provides various helper routines.
Index ¶
- Constants
- func GenGeneralName(jobName, rtype, index string) string
- func GetCondition(status apiv1.JobStatus, condType apiv1.JobConditionType) *apiv1.JobCondition
- func GetControllerOwnerReference(owners []v1.OwnerReference) v1.OwnerReference
- func GetLastCondition(status apiv1.JobStatus, condType apiv1.JobConditionType) *apiv1.JobCondition
- func HasCondition(status apiv1.JobStatus, condType apiv1.JobConditionType) bool
- func IntPtr(i int) *int
- func IsCreated(status apiv1.JobStatus) bool
- func IsDequeued(status apiv1.JobStatus) bool
- func IsEnqueued(status apiv1.JobStatus) bool
- func IsEvicted(status apiv1.JobStatus) bool
- func IsFailed(status apiv1.JobStatus) bool
- func IsJustCreated(status apiv1.JobStatus) bool
- func IsRestarting(status apiv1.JobStatus) bool
- func IsRunning(status apiv1.JobStatus) bool
- func IsSucceeded(status apiv1.JobStatus) bool
- func JsonDump(obj interface{}) string
- func LoggerForJob(job metav1.Object) *log.Entry
- func LoggerForKey(key string) *log.Entry
- func LoggerForPod(pod *v1.Pod, kind string) *log.Entry
- func LoggerForReplica(job metav1.Object, rtype string) *log.Entry
- func LoggerForUnstructured(obj *metav1unstructured.Unstructured, kind string) *log.Entry
- func MergeMap(a, b map[string]string) map[string]string
- func NeedEnqueueToCoordinator(status apiv1.JobStatus) bool
- func Pformat(value interface{}) string
- func RandString(n int) string
- func Time(s *time.Time) time.Time
- func TimePtr(t time.Time) *time.Time
- func ToPodPointerList(list []corev1.Pod) []*corev1.Pod
- func ToServicePointerList(list []corev1.Service) []*corev1.Service
- func UInt32Ptr(i uint32) *uint32
- func UpdateJobConditions(jobStatus *apiv1.JobStatus, conditionType apiv1.JobConditionType, ...) error
- type AggregatedErrors
Constants ¶
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" // JobEnqueuedReason is added in a job when it is queuing and being enqueued. JobEnqueuedReason = "JobEnqueued" // JobDequeuedReason is added in a job when it is queuing and being dequeued. JobDequeuedReason = "JobDequeued" // JobEvictedReason is added in a job when it is evicted. JobEvictedReason = "JobEvicted" )
Variables ¶
This section is empty.
Functions ¶
func GenGeneralName ¶ added in v0.2.0
GenGeneralName generate a name from the given jobName rtype and index.
func GetCondition ¶
func GetCondition(status apiv1.JobStatus, condType apiv1.JobConditionType) *apiv1.JobCondition
GetCondition returns the condition with the provided type.
func GetControllerOwnerReference ¶
func GetControllerOwnerReference(owners []v1.OwnerReference) v1.OwnerReference
func GetLastCondition ¶ added in v0.5.0
func GetLastCondition(status apiv1.JobStatus, condType apiv1.JobConditionType) *apiv1.JobCondition
func HasCondition ¶
func HasCondition(status apiv1.JobStatus, condType apiv1.JobConditionType) bool
func IsDequeued ¶ added in v0.5.0
func IsEnqueued ¶ added in v0.5.0
func IsJustCreated ¶ added in v0.5.0
IsJustCreated checks if the job has created.
func IsRestarting ¶
IsRestarting checks if the job is restarting.
func IsSucceeded ¶
IsSucceeded checks if the job is succeeded.
func LoggerForKey ¶
func LoggerForUnstructured ¶
func LoggerForUnstructured(obj *metav1unstructured.Unstructured, kind string) *log.Entry
func NeedEnqueueToCoordinator ¶ added in v0.5.0
NeedEnqueueToCoordinator checks if the job need to be enqueued into coordinator if feature-gate is enabled
func Pformat ¶
func Pformat(value interface{}) string
Pformat returns a pretty format output of any value that can be marshaled to JSON.
func RandString ¶
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 ToPodPointerList ¶
ToPodPointerList convert pod list to pod pointer list
func ToServicePointerList ¶
ToServicePointerList convert service list to service point list
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 AggregatedErrors ¶ added in v0.4.3
type AggregatedErrors []error
func NewAggregatedErrors ¶ added in v0.4.3
func NewAggregatedErrors() AggregatedErrors
func (*AggregatedErrors) Collect ¶ added in v0.4.3
func (agg *AggregatedErrors) Collect(err error)
func (*AggregatedErrors) Count ¶ added in v0.4.3
func (agg *AggregatedErrors) Count() int
func (*AggregatedErrors) Error ¶ added in v0.4.3
func (agg *AggregatedErrors) Error() error
func (*AggregatedErrors) Errors ¶ added in v0.4.3
func (agg *AggregatedErrors) Errors() []error
Directories ¶
Path | Synopsis |
---|---|
Package that various helper routines for training.
|
Package that various helper routines for training. |