Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NAME = "github.com/goto/optimus"
LAST_COMMIT := $(shell git rev-parse --short HEAD)
LAST_TAG := "$(shell git rev-list --tags --max-count=1)"
OPMS_VERSION := "$(shell git describe --tags ${LAST_TAG})-next"
PROTON_COMMIT := "8ddad14e124639b9921e03c92775629df7cb7d80"
PROTON_COMMIT := "1cd9b0df7e477f45670d43a435e9153550d11e7a"


.PHONY: build test test-ci generate-proto unit-test-ci integration-test vet coverage clean install lint
Expand Down
6 changes: 5 additions & 1 deletion core/scheduler/handler/v1beta1/job_run_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/goto/optimus/core/scheduler"
"github.com/goto/optimus/core/tenant"
pb "github.com/goto/optimus/protos/gotocompany/optimus/core/v1beta1"
)

Expand All @@ -25,6 +26,7 @@ func fromJobRunLineageSummaryRequest(req *pb.GetJobRunLineageSummaryRequest) ([]
targetJobSchedules = append(targetJobSchedules, &scheduler.JobSchedule{
JobName: scheduler.JobName(jobReq.GetJobName()),
ScheduledAt: jobReq.GetScheduledAt().AsTime(),
ProjectName: tenant.ProjectName(jobReq.GetProjectName()),
})
}

Expand Down Expand Up @@ -82,7 +84,8 @@ func toJobRunLineageSummaryResponse(jobRunLineages []*scheduler.JobRunLineage) *
}

pbJobRuns = append(pbJobRuns, &pb.JobExecutionSummary{
JobName: run.JobName.String(),
JobName: run.JobName.String(),
ProjectName: run.ProjectName.String(),
Sla: &pb.SLAConfig{
Duration: durationpb.New(run.SLA.Duration),
},
Expand All @@ -104,6 +107,7 @@ func toJobRunLineageSummaryResponse(jobRunLineages []*scheduler.JobRunLineage) *

pbJobRunLineages = append(pbJobRunLineages, &pb.JobRunLineageSummary{
JobName: lineage.JobName.String(),
ProjectName: lineage.ProjectName.String(),
ScheduledAt: timestamppb.New(lineage.JobRuns[0].JobRunSummary.ScheduledAt),
JobRuns: pbJobRuns,
})
Expand Down
16 changes: 16 additions & 0 deletions core/scheduler/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,19 @@ type ChangelogFilter struct {
StartTime time.Time
EndTime time.Time
}

type JobIdentifier struct {
JobName JobName
ProjectName tenant.ProjectName
}

func NewJobIdentifier(jobName JobName, projectName tenant.ProjectName) JobIdentifier {
return JobIdentifier{
JobName: jobName,
ProjectName: projectName,
}
}

func (j *JobIdentifier) String() string {
return fmt.Sprintf("%s/%s", j.ProjectName, j.JobName)
}
17 changes: 15 additions & 2 deletions core/scheduler/job_lineage.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (

type JobSchedule struct {
JobName JobName
ProjectName tenant.ProjectName
ScheduledAt time.Time
}

Expand All @@ -32,6 +33,13 @@ type JobLineageSummary struct {
JobRuns map[string]*JobRunSummary
}

func (j *JobLineageSummary) JobIdentifier() JobIdentifier {
return JobIdentifier{
JobName: j.JobName,
ProjectName: j.Tenant.ProjectName(),
}
}

type upstreamCandidate struct {
JobName JobName
EndTime time.Time
Expand Down Expand Up @@ -162,6 +170,7 @@ func (j *JobLineageSummary) Flatten(maxDepth int) []*JobExecutionSummary {
if latestJobRun != nil {
result = append(result, &JobExecutionSummary{
JobName: current.JobName,
ProjectName: current.Tenant.ProjectName(),
SLA: current.SLA,
Level: level,
JobRunSummary: latestJobRun,
Expand All @@ -179,14 +188,16 @@ func (j *JobLineageSummary) Flatten(maxDepth int) []*JobExecutionSummary {

type JobRunLineage struct {
JobName JobName
ProjectName tenant.ProjectName
ScheduledAt time.Time
JobRuns []*JobExecutionSummary
}

// JobExecutionSummary is a flattened version of JobLineageSummary
type JobExecutionSummary struct {
JobName JobName
SLA SLAConfig
JobName JobName
ProjectName tenant.ProjectName
SLA SLAConfig
// Level marks the distance from the original job in question
Level int
JobRunSummary *JobRunSummary
Expand All @@ -198,6 +209,8 @@ type SLAConfig struct {

type JobRunSummary struct {
JobName JobName
ProjectName tenant.ProjectName

ScheduledAt time.Time
SLATime *time.Time

Expand Down
1 change: 1 addition & 0 deletions core/scheduler/job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,6 @@ type AlertManagerConfig struct {

type JobRunIdentifier struct {
JobName JobName
ProjectName tenant.ProjectName
ScheduledAt time.Time
}
Loading
Loading