eventutil

package
v0.4.47 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiJobFromLogSubmitJob

func ApiJobFromLogSubmitJob(ownerId string, groups []string, queueName string, jobSetName string, time time.Time, e *armadaevents.SubmitJob) (*api.Job, error)

ApiJobFromLogSubmitJob converts a SubmitJob log message into an api.Job struct, which is used by Armada internally.

func ApiJobsFromLogSubmitJobs

func ApiJobsFromLogSubmitJobs(
	userId string,
	groups []string,
	queueName string,
	jobSetName string,
	time time.Time,
	es []*armadaevents.SubmitJob,
) ([]*api.Job, error)

ApiJobsFromLogSubmitJobs converts a slice of log jobs to API jobs.

func CompactEventSequences

func CompactEventSequences(sequences []*armadaevents.EventSequence) []*armadaevents.EventSequence

CompactEventSequences converts a []*armadaevents.EventSequence into a []*armadaevents.EventSequence of minimal length. In particular, it moves events with equal (queue, jobSetName, userId, groups) into a single sequence when doing so is possible without changing the order of events within job sets.

For example, three sequences [A, B, C], [D, E], [F, G] could result in the following two sequences [A, B, C, F, G], [D, E], if sequence 1 and 3 share the same (queue, jobSetName, userId, groups) and if the sequence [D, E] is for a different job set.

func K8sObjectMetaFromLogObjectMeta

func K8sObjectMetaFromLogObjectMeta(meta *armadaevents.ObjectMeta) *metav1.ObjectMeta

func K8sServicesIngressesFromApiJob

func K8sServicesIngressesFromApiJob(job *api.Job, ingressConfig *configuration.IngressConfiguration) ([]*v1.Service, []*networking.Ingress, error)

K8sServicesIngressesFromApiJob converts job.Services and job.Ingress to k8s services and ingresses.

func LimitSequenceByteSize

func LimitSequenceByteSize(sequence *armadaevents.EventSequence, sizeInBytes uint, strict bool) ([]*armadaevents.EventSequence, error)

LimitSequenceByteSize returns a slice of sequences produced by breaking up sequence.Events into separate sequences If strict is true, each sequence will be at most sizeInBytes bytes in size If strict is false, sizeInBytes can be exceeded by at most the size of a single sequence.Event

func LimitSequencesByteSize

func LimitSequencesByteSize(sequences []*armadaevents.EventSequence, sizeInBytes uint, strict bool) ([]*armadaevents.EventSequence, error)

LimitSequencesByteSize calls LimitSequenceByteSize for each of the provided sequences and returns all resulting sequences.

func LogObjectMetaFromK8sObjectMeta

func LogObjectMetaFromK8sObjectMeta(meta *metav1.ObjectMeta) *armadaevents.ObjectMeta

func LogSubmitJobFromApiJob

func LogSubmitJobFromApiJob(job *api.Job) (*armadaevents.SubmitJob, error)

LogSubmitJobFromApiJob converts an API job to a log job. Note that PopulateK8sServicesIngresses must be called first if job.Services and job.Ingress is to be included in the resulting log job, since the log job can only include k8s objects (i.e., not the API-specific job.Services or job.Ingress).

func LogSubmitObjectsFromApiJob

func LogSubmitObjectsFromApiJob(job *api.Job) (*armadaevents.KubernetesMainObject, []*armadaevents.KubernetesObject, error)

LogSubmitObjectsFromApiJob extracts all objects from an API job for inclusion in a log job.

To extract services and ingresses, PopulateK8sServicesIngresses must be called on the job first to convert API-specific job objects to proper K8s objects.

func LogSubmitPriorityFromApiPriority

func LogSubmitPriorityFromApiPriority(priority float64) uint32

LogSubmitPriorityFromApiPriority returns the uint32 representation of the priority included with a submitted job, or an error if the conversion fails.

func PopulateK8sServicesIngresses

func PopulateK8sServicesIngresses(job *api.Job, ingressConfig *configuration.IngressConfiguration) error

PopulateK8sServicesIngresses converts the API-specific service and ingress object into K8s objects and stores those in the job object.

func ShortSequenceString

func ShortSequenceString(sequence *armadaevents.EventSequence) string

ShortSequenceString returns a short string representation of an events sequence. To be used for logging, for example.

func UnmarshalEventSequence

func UnmarshalEventSequence(ctx *armadacontext.Context, payload []byte) (*armadaevents.EventSequence, error)

UnmarshalEventSequence returns an EventSequence object contained in a byte buffer after validating that the resulting EventSequence is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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