eventutil

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const LEGACY_RUN_ID = "00000000000000000000000000"

Id used for messages for which we can't use the kubernetesId.

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 added in v0.3.8

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

CompactEventSequences converts a []*armadaevents.EventSequence into a []*armadaevents.EventSequence of minimal length. In particular, it moves all events part of sequences with equal (queue, jobSetName, userId) into a single sequence. The groups field is set to that of the first event in the sequence for a each (queue, jobSetName, userId). This function may mutates the input sequences, i.e., it should be used like sequences = CompactEventSequences(sequences).

func EventSequenceFromApiEvent added in v0.3.8

func EventSequenceFromApiEvent(msg *api.EventMessage) (sequence *armadaevents.EventSequence, err error)

EventSequenceFromApiEvent converts an api.EventMessage into the corresponding Pulsar event and returns an EventSequence containing this single event. We map API events to sequences one-to-one because each API event may contain different (queue, jobSet, userId), which must be common to all events in a sequence.

func EventSequencesFromApiEvents added in v0.3.8

func EventSequencesFromApiEvents(msgs []*api.EventMessage) ([]*armadaevents.EventSequence, error)

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 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, error)

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 added in v0.3.2

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 context.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