Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigHasSecretVolumes(config *task.TaskConfig) bool
- func Contains(list []string, item string) bool
- func ContainsTaskState(list []task.TaskState, item task.TaskState) bool
- func ConvertInstanceIDListToInstanceRange(instIDs []uint32) []*pod.InstanceIDRange
- func ConvertLabels(pelotonLabels []*peloton.Label) *mesos.Labels
- func ConvertTimestampToUnixSeconds(timestamp string) (int64, error)
- func CreateHostInfo(hostname string, agentInfo *mesos.AgentInfo) *hostsvc.HostInfo
- func CreateLeaseIDFromHostOfferID(id *peloton.HostOfferID) *pbhostmgr.LeaseID
- func CreateMesosScalarResources(values map[string]float64, role string) []*mesos.Resource
- func CreateMesosTaskID(jobID *peloton.JobID, instanceID uint32, runID uint64) *mesos.TaskID
- func CreatePelotonTaskID(jobID string, instanceID uint32) string
- func CreatePodIDFromMesosTaskID(t *mesos.TaskID) *v1alphapeloton.PodID
- func CreatePortRanges(portSet map[uint32]bool) *mesos.Value_Ranges
- func CreatePortResources(portSet map[uint32]string) []*mesos.Resource
- func CreateSecretVolume(secretPath string, secretStr string) *mesos.Volume
- func ExtractIPAndPortFromMesosAgentPID(pid string) (string, string, error)
- func ExtractPortSet(resource *mesos.Resource) map[uint32]bool
- func GetDereferencedJobIDsList(jobIDs []*peloton.JobID) []peloton.JobID
- func GetOfferScalarResourceSummary(offer *mesos.Offer) map[string]map[string]float64
- func GetPortsNumFromOfferMap(offerMap map[string]*mesos.Offer) uint32
- func GetPortsSetFromResources(resources []*mesos.Resource) map[uint32]bool
- func IntersectSlice(slice1 []uint32, slice2 []uint32) []uint32
- func IsPelotonJobStateTerminal(state job.JobState) bool
- func IsPelotonPodStateTerminal(state pod.PodState) bool
- func IsPelotonStateTerminal(state task.TaskState) bool
- func IsSecretVolume(volume *mesos.Volume) bool
- func IsTaskHasValidVolume(taskInfo *task.TaskInfo) bool
- func IsTaskThrottled(state task.TaskState, message string) bool
- func Max(x, y uint32) uint32
- func MesosStateToPelotonState(mstate mesos.TaskState) task.TaskState
- func Min(x, y uint32) uint32
- func ParseJobAndInstanceID(mesosTaskID string) (string, uint32, error)
- func ParseRunID(mesosTaskID string) (uint64, error)
- func ParseTaskID(taskID string) (string, uint32, error)
- func ParseTaskIDFromMesosTaskID(mesosTaskID string) (string, error)
- func PtrPrintf(format string, a ...interface{}) *string
- func RemoveSecretVolumesFromConfig(config *task.TaskConfig) []*mesos.Volume
- func RemoveSecretVolumesFromJobConfig(cfg *job.JobConfig) []*mesos.Volume
- func RunInParallel(identifier string, idList []uint32, task singleTask) error
- func SubtractSlice(slice1 []uint32, slice2 []uint32) []uint32
- func UnmarshalToType(jsonString string, resultType reflect.Type) (interface{}, error)
- type MesosResourceBuilder
- func (o *MesosResourceBuilder) Build() *mesos.Resource
- func (o *MesosResourceBuilder) WithDisk(diskInfo *mesos.Resource_DiskInfo) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithName(name string) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithRanges(ranges *mesos.Value_Ranges) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithReservation(reservation *mesos.Resource_ReservationInfo) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithRevocable(revocable *mesos.Resource_RevocableInfo) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithRole(role string) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithType(t mesos.Value_Type) *MesosResourceBuilder
- func (o *MesosResourceBuilder) WithValue(value float64) *MesosResourceBuilder
Constants ¶
const ( // ResourceEpsilon is the minimum epsilon mesos resource; // This is because Mesos internally uses a fixed point precision. See MESOS-4687 for details. ResourceEpsilon = 0.0009 )
Variables ¶
var UUIDLength = len(uuid.New())
UUIDLength represents the length of a 16 byte v4 UUID as a string
Functions ¶
func ConfigHasSecretVolumes ¶
func ConfigHasSecretVolumes(config *task.TaskConfig) bool
ConfigHasSecretVolumes returns true if config contains secret volumes
func ContainsTaskState ¶
ContainsTaskState checks whether a TaskState contains in a list of TaskStates
func ConvertInstanceIDListToInstanceRange ¶
func ConvertInstanceIDListToInstanceRange(instIDs []uint32) []*pod.InstanceIDRange
ConvertInstanceIDListToInstanceRange converts list of instance ids to list of instance ranges
func ConvertLabels ¶
ConvertLabels will convert Peloton labels to Mesos labels.
func ConvertTimestampToUnixSeconds ¶
ConvertTimestampToUnixSeconds converts timestamp string in RFC3339 format to the unix time in seconds.
func CreateHostInfo ¶
CreateHostInfo takes the agent Info and create the hostsvc.HostInfo
func CreateLeaseIDFromHostOfferID ¶
func CreateLeaseIDFromHostOfferID(id *peloton.HostOfferID) *pbhostmgr.LeaseID
CreateLeaseIDFromHostOfferID creates a LeaseId from host offer ID.
func CreateMesosScalarResources ¶
CreateMesosScalarResources is a helper function to convert resource values into Mesos resources.
func CreateMesosTaskID ¶
CreateMesosTaskID creates mesos task id given jobID, instanceID and runID
func CreatePelotonTaskID ¶
CreatePelotonTaskID creates a PelotonTaskID given jobID and instanceID
func CreatePodIDFromMesosTaskID ¶
func CreatePodIDFromMesosTaskID(t *mesos.TaskID) *v1alphapeloton.PodID
CreatePodIDFromMesosTaskID creates a peloton pod ID from mesos taskID.
func CreatePortRanges ¶
func CreatePortRanges(portSet map[uint32]bool) *mesos.Value_Ranges
CreatePortRanges create Mesos Ranges type from given port set.
func CreatePortResources ¶
CreatePortResources create a list of Mesos resources suitable for launching from a map from port number to role name.
func CreateSecretVolume ¶
CreateSecretVolume builds a mesos volume of type secret from the given secret path and secret value string This volume will be added to the job's default config
func ExtractIPAndPortFromMesosAgentPID ¶
ExtractIPAndPortFromMesosAgentPID parses Mesos PID to extract IP-address and port number (if present).
func ExtractPortSet ¶
ExtractPortSet is helper function to extract available port set from a Mesos resource.
func GetDereferencedJobIDsList ¶
GetDereferencedJobIDsList dereferences the jobIDs list
func GetOfferScalarResourceSummary ¶
GetOfferScalarResourceSummary generates a summary for all the scalar values: role -> offerName-> Value first level : role -> map(resource type-> resouce value)
func GetPortsNumFromOfferMap ¶
GetPortsNumFromOfferMap is helper function to get number of available ports from given id to offer map.
func GetPortsSetFromResources ¶
GetPortsSetFromResources is helper function to extract ports resources.
func IntersectSlice ¶
IntersectSlice get return the result of slice1 ∩ slice2 element must be present in both slices
func IsPelotonJobStateTerminal ¶
IsPelotonJobStateTerminal returns true if job state is terminal otherwise false
func IsPelotonPodStateTerminal ¶
IsPelotonPodStateTerminal returns true if pod state is terminal otherwise false
func IsPelotonStateTerminal ¶
IsPelotonStateTerminal returns true if state is terminal otherwise false
func IsSecretVolume ¶
IsSecretVolume returns true if the given volume is of type secret
func IsTaskHasValidVolume ¶
IsTaskHasValidVolume returns true if a task is stateful and has a valid volume
func IsTaskThrottled ¶
IsTaskThrottled returns true if a task is currently throttled due to repeated failures
func MesosStateToPelotonState ¶
MesosStateToPelotonState translates mesos task state to peloton task state TODO: adjust in case there are additional peloton states
func ParseJobAndInstanceID ¶
ParseJobAndInstanceID return jobID and instanceID from given mesos task id.
func ParseRunID ¶
ParseRunID parse the runID from mesosTaskID
func ParseTaskID ¶
ParseTaskID parses the jobID and instanceID from peloton taskID
func ParseTaskIDFromMesosTaskID ¶
ParseTaskIDFromMesosTaskID parses the taskID from mesosTaskID
func RemoveSecretVolumesFromConfig ¶
func RemoveSecretVolumesFromConfig(config *task.TaskConfig) []*mesos.Volume
RemoveSecretVolumesFromConfig removes secret volumes from the task config in place and returns the secret volumes Secret volumes are added internally at the time of creating a job with secrets by handleSecrets method. They are not supplied in the config in job create/update requests. Consequently, they should not be displayed as part of Job Get API response. This is necessary to achieve the broader goal of using the secrets proto message in Job Create/Update/Get API to describe secrets and not allow users to checkin secrets as part of config
func RemoveSecretVolumesFromJobConfig ¶
RemoveSecretVolumesFromJobConfig removes secret volumes from the default config as well as instance config in place and returns the secret volumes
func RunInParallel ¶
RunInParallel runs go routines which will perform action on given list of instances
func SubtractSlice ¶
SubtractSlice returns the result of slice1 - slice2 if an element is in slice2 but not in slice1, it would be ignored
Types ¶
type MesosResourceBuilder ¶
MesosResourceBuilder is the helper to build a mesos resource
func NewMesosResourceBuilder ¶
func NewMesosResourceBuilder() *MesosResourceBuilder
NewMesosResourceBuilder creates a MesosResourceBuilder
func (*MesosResourceBuilder) Build ¶
func (o *MesosResourceBuilder) Build() *mesos.Resource
Build returns the mesos resource
func (*MesosResourceBuilder) WithDisk ¶
func (o *MesosResourceBuilder) WithDisk( diskInfo *mesos.Resource_DiskInfo) *MesosResourceBuilder
WithDisk sets disk info.
func (*MesosResourceBuilder) WithName ¶
func (o *MesosResourceBuilder) WithName(name string) *MesosResourceBuilder
WithName sets name
func (*MesosResourceBuilder) WithRanges ¶
func (o *MesosResourceBuilder) WithRanges(ranges *mesos.Value_Ranges) *MesosResourceBuilder
WithRanges sets ranges
func (*MesosResourceBuilder) WithReservation ¶
func (o *MesosResourceBuilder) WithReservation( reservation *mesos.Resource_ReservationInfo) *MesosResourceBuilder
WithReservation sets reservation info.
func (*MesosResourceBuilder) WithRevocable ¶
func (o *MesosResourceBuilder) WithRevocable( revocable *mesos.Resource_RevocableInfo) *MesosResourceBuilder
WithRevocable sets resource as revocable resource type
func (*MesosResourceBuilder) WithRole ¶
func (o *MesosResourceBuilder) WithRole(role string) *MesosResourceBuilder
WithRole sets role
func (*MesosResourceBuilder) WithType ¶
func (o *MesosResourceBuilder) WithType(t mesos.Value_Type) *MesosResourceBuilder
WithType sets type
func (*MesosResourceBuilder) WithValue ¶
func (o *MesosResourceBuilder) WithValue(value float64) *MesosResourceBuilder
WithValue sets value