Skip to content

Commit

Permalink
Use action.platform instead of command.platform in one more place (#8080
Browse files Browse the repository at this point in the history
)

I guess I missed this one as well.
  • Loading branch information
vanja-p authored Dec 19, 2024
1 parent 05d2b97 commit 8d1f01b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ func (s *ExecutionServer) markTaskComplete(ctx context.Context, actionResourceNa
if sizer := s.env.GetTaskSizer(); sizer != nil && execErr == nil && executeResponse.GetResult().GetExitCode() == 0 {
// TODO(vanja) should this be done when the executor got a cache hit?
md := executeResponse.GetResult().GetExecutionMetadata()
if err := sizer.Update(ctx, cmd, md); err != nil {
if err := sizer.Update(ctx, action, cmd, md); err != nil {
log.CtxWarningf(ctx, "Failed to update task size: %s", err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions enterprise/server/tasksize/tasksize.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ func (s *taskSizer) Predict(ctx context.Context, task *repb.ExecutionTask) *scpb
return ApplyLimits(task, s.model.Predict(ctx, task))
}

func (s *taskSizer) Update(ctx context.Context, cmd *repb.Command, md *repb.ExecutedActionMetadata) error {
func (s *taskSizer) Update(ctx context.Context, action *repb.Action, cmd *repb.Command, md *repb.ExecutedActionMetadata) error {
if !*useMeasuredSizes {
return nil
}
statusLabel := "ok"
defer func() {
props, err := platform.ParseProperties(&repb.ExecutionTask{Command: cmd})
props, err := platform.ParseProperties(&repb.ExecutionTask{Action: action, Command: cmd})
if err != nil {
log.CtxInfof(ctx, "Failed to parse task properties: %s", err)
}
Expand Down
8 changes: 4 additions & 4 deletions enterprise/server/tasksize/tasksize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestSizer_Get_ShouldReturnRecordedUsageStats(t *testing.T) {
// Set the completed timestamp so that the exec duration is 2 seconds.
ExecutionCompletedTimestamp: timestamppb.New(execStart.Add(2 * time.Second)),
}
err = sizer.Update(ctx, task.GetCommand(), md)
err = sizer.Update(ctx, task.GetAction(), task.GetCommand(), md)

require.NoError(t, err)

Expand Down Expand Up @@ -294,7 +294,7 @@ func TestSizer_RespectsMilliCPULimit(t *testing.T) {
ExecutionStartTimestamp: timestamppb.New(execStart),
ExecutionCompletedTimestamp: timestamppb.New(execStart.Add(1 * time.Second)),
}
err = sizer.Update(ctx, task.GetCommand(), md)
err = sizer.Update(ctx, task.GetAction(), task.GetCommand(), md)
require.NoError(t, err)

ts := sizer.Get(ctx, task)
Expand Down Expand Up @@ -335,7 +335,7 @@ func TestSizer_RespectsMinimumSize(t *testing.T) {
ExecutionCompletedTimestamp: timestamppb.New(execStart.Add(1 * time.Second)),
}

err = sizer.Update(ctx, task.GetCommand(), md)
err = sizer.Update(ctx, task.GetAction(), task.GetCommand(), md)
require.NoError(t, err)

ts := sizer.Get(ctx, task)
Expand All @@ -351,7 +351,7 @@ func TestSizer_RespectsMinimumSize(t *testing.T) {
},
},
}
err = sizer.Update(ctx, task.GetCommand(), md)
err = sizer.Update(ctx, task.GetAction(), task.GetCommand(), md)
require.NoError(t, err)

ts = sizer.Get(ctx, task)
Expand Down
2 changes: 1 addition & 1 deletion server/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ type TaskSizer interface {
Predict(ctx context.Context, task *repb.ExecutionTask) *scpb.TaskSize

// Update records a measured task size.
Update(ctx context.Context, cmd *repb.Command, md *repb.ExecutedActionMetadata) error
Update(ctx context.Context, action *repb.Action, cmd *repb.Command, md *repb.ExecutedActionMetadata) error
}

// ScheduledTask represents an execution task along with its scheduling metadata
Expand Down

0 comments on commit 8d1f01b

Please sign in to comment.