Skip to content

Commit

Permalink
Remove gogo timestamp from public api protos (#3750)
Browse files Browse the repository at this point in the history
* initial timestamps

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* initial timestamps

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* initial timestamps

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* tests

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* regen proto

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* fix diff

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* more fixes

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* lint

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

* fix tests

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>

---------

Signed-off-by: Chris Martin <chris@cmartinit.co.uk>
Co-authored-by: Chris Martin <chris@cmartinit.co.uk>
  • Loading branch information
d80tb7 and d80tb7 authored Jul 1, 2024
1 parent 481b2de commit 3dbdb28
Show file tree
Hide file tree
Showing 21 changed files with 1,261 additions and 1,004 deletions.
49 changes: 25 additions & 24 deletions internal/armada/event/conversion/conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"

"github.com/armadaproject/armada/internal/common/eventutil"
protoutil "github.com/armadaproject/armada/internal/common/proto"
"github.com/armadaproject/armada/pkg/api"
"github.com/armadaproject/armada/pkg/armadaevents"
)
Expand Down Expand Up @@ -87,15 +88,15 @@ func FromInternalSubmit(owner string, groups []string, queue string, jobSet stri
JobId: jobId,
JobSetId: jobSet,
Queue: queue,
Created: time,
Created: protoutil.ToTimestamp(time),
Job: *job,
}

queuedEvent := &api.JobQueuedEvent{
JobId: jobId,
JobSetId: jobSet,
Queue: queue,
Created: time,
Created: protoutil.ToTimestamp(time),
}

return []*api.EventMessage{
Expand Down Expand Up @@ -125,7 +126,7 @@ func FromInternalPreemptionRequested(userId string, queueName string, jobSetName
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Requestor: userId,
},
},
Expand All @@ -146,7 +147,7 @@ func FromInternalCancel(userId string, queueName string, jobSetName string, time
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Requestor: userId,
},
},
Expand All @@ -167,7 +168,7 @@ func FromInternalCancelled(userId string, queueName string, jobSetName string, t
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Requestor: userId,
},
},
Expand All @@ -187,7 +188,7 @@ func FromInternalReprioritiseJob(userId string, queueName string, jobSetName str
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
NewPriority: float64(e.Priority),
Requestor: userId,
},
Expand All @@ -208,7 +209,7 @@ func FromInternalReprioritisedJob(userId string, queueName string, jobSetName st
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
NewPriority: float64(e.Priority),
Requestor: userId,
},
Expand All @@ -229,7 +230,7 @@ func FromInternalLogJobRunLeased(queueName string, jobSetName string, time time.
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
ClusterId: e.ExecutorId,
},
},
Expand All @@ -247,7 +248,7 @@ func FromInternalJobSucceeded(queueName string, jobSetName string, time time.Tim
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
}

if len(e.ResourceInfos) > 0 {
Expand Down Expand Up @@ -285,7 +286,7 @@ func FromInternalJobRunErrors(queueName string, jobSetName string, time time.Tim
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
},
},
}
Expand All @@ -305,7 +306,7 @@ func FromInternalJobRunErrors(queueName string, jobSetName string, time time.Tim
PodNumber: reason.PodUnschedulable.GetPodNumber(),
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
},
},
}
Expand All @@ -318,7 +319,7 @@ func FromInternalJobRunErrors(queueName string, jobSetName string, time time.Tim
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
ClusterId: objectMeta.GetExecutorId(),
Reason: reason.PodLeaseReturned.GetMessage(),
KubernetesId: objectMeta.GetKubernetesId(),
Expand All @@ -338,7 +339,7 @@ func FromInternalJobRunErrors(queueName string, jobSetName string, time time.Tim
PodNamespace: objectMeta.GetNamespace(),
PodName: objectMeta.GetName(),
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
ClusterId: objectMeta.GetExecutorId(),
Reason: reason.PodTerminated.GetMessage(),
KubernetesId: objectMeta.GetKubernetesId(),
Expand Down Expand Up @@ -379,7 +380,7 @@ func FromInternalJobErrors(queueName string, jobSetName string, time time.Time,
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Reason: "preempted",
},
},
Expand All @@ -392,7 +393,7 @@ func FromInternalJobErrors(queueName string, jobSetName string, time time.Time,
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Reason: reason.MaxRunsExceeded.Message,
},
},
Expand All @@ -405,7 +406,7 @@ func FromInternalJobErrors(queueName string, jobSetName string, time time.Time,
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Reason: reason.GangJobUnschedulable.Message,
},
},
Expand All @@ -418,7 +419,7 @@ func FromInternalJobErrors(queueName string, jobSetName string, time time.Time,
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
Reason: reason.JobRejected.Message,
Cause: api.Cause_Rejected,
},
Expand All @@ -433,7 +434,7 @@ func FromInternalJobErrors(queueName string, jobSetName string, time time.Time,
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
},
},
}
Expand All @@ -453,7 +454,7 @@ func FromInternalJobRunRunning(queueName string, jobSetName string, time time.Ti
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
}

if len(e.ResourceInfos) > 0 {
Expand Down Expand Up @@ -485,7 +486,7 @@ func FromInternalJobRunAssigned(queueName string, jobSetName string, time time.T
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
}

if len(e.ResourceInfos) > 0 {
Expand Down Expand Up @@ -540,7 +541,7 @@ func FromInternalJobRunPreempted(queueName string, jobSetName string, time time.
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
RunId: runId,
PreemptiveJobId: preemptiveJobId,
PreemptiveRunId: preemptiveRunId,
Expand All @@ -565,7 +566,7 @@ func FromInternalResourceUtilisation(queueName string, jobSetName string, time t
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
ClusterId: e.GetResourceInfo().GetObjectMeta().GetExecutorId(),
KubernetesId: e.GetResourceInfo().GetObjectMeta().GetKubernetesId(),
MaxResourcesForPeriod: e.MaxResourcesForPeriod,
Expand Down Expand Up @@ -595,7 +596,7 @@ func FromInternalStandaloneIngressInfo(queueName string, jobSetName string, time
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
ClusterId: e.GetObjectMeta().GetExecutorId(),
KubernetesId: e.GetObjectMeta().GetKubernetesId(),
NodeName: e.GetNodeName(),
Expand All @@ -620,7 +621,7 @@ func makeJobFailed(jobId string, queueName string, jobSetName string, time time.
JobId: jobId,
JobSetId: jobSetName,
Queue: queueName,
Created: time,
Created: protoutil.ToTimestamp(time),
ClusterId: podError.GetObjectMeta().GetExecutorId(),
PodNamespace: podError.GetObjectMeta().GetNamespace(),
KubernetesId: podError.GetObjectMeta().GetKubernetesId(),
Expand Down
Loading

0 comments on commit 3dbdb28

Please sign in to comment.