Skip to content

Commit

Permalink
Merge branch 'master' into f/chrisma/move-common
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMurkin authored Sep 2, 2024
2 parents 1cb8803 + 2573a91 commit 71cf64a
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 216 deletions.
8 changes: 1 addition & 7 deletions internal/common/eventutil/eventutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ func ShortSequenceString(sequence *armadaevents.EventSequence) string {

// ApiJobFromLogSubmitJob converts a SubmitJob log message into an api.Job struct, which is used by Armada internally.
func ApiJobFromLogSubmitJob(ownerId string, groups []string, queueName string, jobSetName string, time time.Time, e *armadaevents.SubmitJob) (*api.Job, error) {
jobId, err := armadaevents.UlidStringFromProtoUuid(e.JobId)
if err != nil {
err = errors.WithStack(err)
return nil, err
}

if e == nil || e.MainObject == nil || e.MainObject.Object == nil {
return nil, errors.Errorf("SubmitJob or one of its member pointers is nil")
}
Expand Down Expand Up @@ -146,7 +140,7 @@ func ApiJobFromLogSubmitJob(ownerId string, groups []string, queueName string, j
}

return &api.Job{
Id: jobId,
Id: e.JobIdStr,
ClientId: e.DeduplicationId,
Queue: queueName,
JobSetId: jobSetName,
Expand Down
21 changes: 9 additions & 12 deletions internal/eventingester/convert/conversions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/apache/pulsar-client-go/pulsar"
"github.com/gogo/protobuf/proto"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"

"github.com/armadaproject/armada/internal/common/armadacontext"
Expand All @@ -26,8 +25,6 @@ const (
)

var (
jobIdProto, _ = armadaevents.ProtoUuidFromUlidString(jobIdString)
runIdProto = armadaevents.ProtoUuidFromUuid(uuid.MustParse(runIdString))
baseTime, _ = time.Parse("2006-01-02T15:04:05.000Z", "2022-03-01T15:04:05.000Z")
baseTimeProto = protoutil.ToTimestamp(baseTime)
)
Expand All @@ -37,8 +34,8 @@ var jobRunSucceeded = &armadaevents.EventSequence_Event{
Created: baseTimeProto,
Event: &armadaevents.EventSequence_Event_JobRunSucceeded{
JobRunSucceeded: &armadaevents.JobRunSucceeded{
RunId: runIdProto,
JobId: jobIdProto,
RunIdStr: runIdString,
JobIdStr: jobIdString,
},
},
}
Expand All @@ -48,7 +45,7 @@ var cancelled = &armadaevents.EventSequence_Event{
Created: baseTimeProto,
Event: &armadaevents.EventSequence_Event_CancelledJob{
CancelledJob: &armadaevents.CancelledJob{
JobId: jobIdProto,
JobIdStr: jobIdString,
},
},
}
Expand Down Expand Up @@ -93,8 +90,8 @@ func TestCancelled(t *testing.T) {
Created: baseTimeProto,
Event: &armadaevents.EventSequence_Event_CancelJob{
CancelJob: &armadaevents.CancelJob{
JobId: jobIdProto,
Reason: "some reason 1",
JobIdStr: jobIdString,
Reason: "some reason 1",
},
},
}, &armadaevents.EventSequence_Event{
Expand All @@ -108,8 +105,8 @@ func TestCancelled(t *testing.T) {
Created: baseTimeProto,
Event: &armadaevents.EventSequence_Event_CancelledJob{
CancelledJob: &armadaevents.CancelledJob{
JobId: jobIdProto,
Reason: "some reason 3",
JobIdStr: jobIdString,
Reason: "some reason 3",
},
},
})
Expand All @@ -124,7 +121,7 @@ func TestCancelled(t *testing.T) {
Created: baseTimeProto,
Event: &armadaevents.EventSequence_Event_CancelJob{
CancelJob: &armadaevents.CancelJob{
JobId: jobIdProto,
JobIdStr: jobIdString,
},
},
},
Expand All @@ -138,7 +135,7 @@ func TestCancelled(t *testing.T) {
Created: baseTimeProto,
Event: &armadaevents.EventSequence_Event_CancelledJob{
CancelledJob: &armadaevents.CancelledJob{
JobId: jobIdProto,
JobIdStr: jobIdString,
},
},
},
Expand Down
Loading

0 comments on commit 71cf64a

Please sign in to comment.