common

package
v1.7.0-2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty = ""

	Wildcard              = "*"
	Separator             = ","
	Space                 = " "
	AnonymousUser         = "nobody"
	AnonymousGroup        = "nogroup"
	RecoveryQueue         = "@recovery@"
	RecoveryQueueFull     = "root." + RecoveryQueue
	DefaultPlacementQueue = "root.default"
)
View Source
const (
	PreemptionPreconditionsFailed = "Preemption preconditions failed"
	PreemptionDoesNotGuarantee    = "Preemption queue guarantees check failed"
	PreemptionShortfall           = "Preemption helped but short of resources"
	PreemptionDoesNotHelp         = "Preemption does not help"
	NoVictimForRequiredNode       = "No fit on required node, preemption does not help"
)

Constant messages for AllocationLog entries

Variables

View Source
var (
	// InvalidQueueName returned when queue name is invalid
	InvalidQueueName = errors.New("invalid queue name, max 64 characters consisting of alphanumeric characters and '-', '_', '#', '@', '/', ':' allowed")
	// ErrorReservingAlloc returned when an ask that is allocated tries to reserve a node.
	ErrorReservingAlloc = errors.New("ask already allocated, no reservation allowed")
	// ErrorDuplicateReserve returned when the same reservation already exists on the application
	ErrorDuplicateReserve = errors.New("reservation already exists")
	// ErrorNodeAlreadyReserved returned when the node is already reserved, failing the reservation
	ErrorNodeAlreadyReserved = errors.New("node is already reserved")
	// ErrorNodeNotFitReserve returned when the allocation does not fit on an empty node, failing the reservation
	ErrorNodeNotFitReserve = errors.New("reservation does not fit on node")
)
View Source
var (
	// ErrorTimeout returned if waiting for a condition times out
	ErrorTimeout = errors.New("timeout waiting for condition")
)

Functions

func ConvertSITimeout

func ConvertSITimeout(millis int64) time.Duration

ConvertSITimeout Convert a SI execution timeout, given in milliseconds into a time.Duration object. This will always return a positive value or zero (0). A negative timeout will be converted into zero (0), which means never timeout. The conversion handles overflows in the conversion by setting it to zero (0) also.

func ConvertSITimeoutWithAdjustment

func ConvertSITimeoutWithAdjustment(siApp *si.AddApplicationRequest, defaultTimeout time.Duration) time.Duration

ConvertSITimeoutWithAdjustment Similar to ConvertSITimeout, but this function also adjusts the timeout if "creationTime" is defined. It's used during Yunikorn restart, in order to properly track how long a placeholder pod should be in "Running" state.

func ConvertSITimestamp

func ConvertSITimestamp(ts string) time.Time

func GetBoolEnvVar

func GetBoolEnvVar(key string, defaultVal bool) bool

func GetConfigurationBool added in v1.4.0

func GetConfigurationBool(configs map[string]string, key string, defaultValue bool) bool

func GetConfigurationInt added in v1.4.0

func GetConfigurationInt(configs map[string]string, key string, defaultValue int) int

func GetConfigurationUint added in v1.4.0

func GetConfigurationUint(configs map[string]string, key string, defaultValue uint64) uint64

func GetNewUUID

func GetNewUUID() string

Generate a new uuid. The chance that we generate a collision is really small. As long as we check the UUID before we communicate it back to the RM we can still replace it without a problem.

func GetNormalizedPartitionName

func GetNormalizedPartitionName(partitionName string, rmID string) string

func GetPartitionNameWithoutClusterID

func GetPartitionNameWithoutClusterID(partitionName string) string

func GetRMIdFromPartitionName

func GetRMIdFromPartitionName(partitionName string) string

func GetRequiredNodeFromTag

func GetRequiredNodeFromTag(tags map[string]string) string

func IsAllowPreemptOther added in v1.3.0

func IsAllowPreemptOther(policy *si.PreemptionPolicy) bool

func IsAllowPreemptSelf added in v1.3.0

func IsAllowPreemptSelf(policy *si.PreemptionPolicy) bool

func IsAppCreationForced added in v1.4.0

func IsAppCreationForced(tags map[string]string) bool

IsAppCreationForced returns true if the application creation is triggered by the shim reporting an existing allocation. In this case, it needs to be accepted regardless of whether it maps to a valid queue.

func IsRecoveryQueue added in v1.4.0

func IsRecoveryQueue(queueName string) bool

IsRecoveryQueue returns true if the given queue represents the recovery queue

func ParseEndpoint

func ParseEndpoint(ep string) (string, string, error)

func WaitForCondition added in v1.2.0

func WaitForCondition(interval time.Duration, timeout time.Duration, eval func() bool) error

func ZeroTimeInUnixNano

func ZeroTimeInUnixNano(t time.Time) *int64

ZeroTimeInUnixNano return the unix nano or nil if the time is zero.

Types

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ss si.SchedulerServer)
	// Waits for the service to stop
	Wait()
	// Stops the service gracefully
	Stop()
	// Stops the service forcefully
	ForceStop()
}

Defines Non blocking GRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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