Skip to content

Commit

Permalink
Revert "chore: add tracing info to some backend APIs" (#9843)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkunapuli authored Aug 21, 2024
1 parent 73a756a commit 707ad07
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 49 deletions.
10 changes: 1 addition & 9 deletions master/internal/api_agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package internal

import (
"context"
"runtime/trace"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand All @@ -21,14 +20,7 @@ import (
func (a *apiServer) GetAgents(
ctx context.Context, req *apiv1.GetAgentsRequest,
) (*apiv1.GetAgentsResponse, error) {
ctx, task := trace.NewTask(ctx, "GetAgents")
defer task.End()

var resp *apiv1.GetAgentsResponse
var err error
trace.WithRegion(ctx, "resourceManager.GetAgents", func() {
resp, err = a.m.rm.GetAgents()
})
resp, err := a.m.rm.GetAgents()
if err != nil {
return nil, err
}
Expand Down
17 changes: 5 additions & 12 deletions master/internal/api_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package internal

import (
"context"
"runtime/trace"

"github.com/determined-ai/determined/master/internal/api"
"github.com/determined-ai/determined/master/internal/job/jobservice"
Expand Down Expand Up @@ -50,17 +49,11 @@ func (a *apiServer) GetJobs(
func (a *apiServer) GetJobsV2(
ctx context.Context, req *apiv1.GetJobsV2Request,
) (resp *apiv1.GetJobsV2Response, err error) {
ctx, task := trace.NewTask(ctx, "GetJobsV2")
defer task.End()

var jobs []*jobv1.Job
trace.WithRegion(ctx, "jobservice.GetJobs", func() {
jobs, err = jobservice.DefaultService.GetJobs(
rm.ResourcePoolName(req.ResourcePool),
req.OrderBy == apiv1.OrderBy_ORDER_BY_DESC,
req.States,
)
})
jobs, err := jobservice.DefaultService.GetJobs(
rm.ResourcePoolName(req.ResourcePool),
req.OrderBy == apiv1.OrderBy_ORDER_BY_DESC,
req.States,
)
if err != nil {
return nil, err
}
Expand Down
9 changes: 1 addition & 8 deletions master/internal/job/jobservice/jobservice.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package jobservice

import (
"context"
"database/sql"
"fmt"
"runtime/trace"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -98,15 +96,10 @@ func (s *Service) GetJobs(
desc bool,
states []jobv1.State,
) ([]*jobv1.Job, error) {
// waiting on this lock
s.mu.Lock()
defer s.mu.Unlock()

var jobQ map[model.JobID]*sproto.RMJobInfo
var err error
trace.WithRegion(context.Background(), "resourceManager.GetJobQ", func() {
jobQ, err = s.rm.GetJobQ(resourcePool)
})
jobQ, err := s.rm.GetJobQ(resourcePool)
if err != nil {
s.syslog.WithError(err).Error("getting job queue info from RM")
return nil, err
Expand Down
9 changes: 1 addition & 8 deletions master/internal/rm/kubernetesrm/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"math"
"os"
"path/filepath"
"runtime/trace"
"slices"
"strconv"
"strings"
Expand Down Expand Up @@ -1050,15 +1049,9 @@ func (j *jobsService) refreshPodStates(allocationID model.AllocationID) error {
}

func (j *jobsService) GetAgents() (*apiv1.GetAgentsResponse, error) {
// waiting on this lock
j.mu.Lock()
defer j.mu.Unlock()
var resp *apiv1.GetAgentsResponse
var err error
trace.WithRegion(context.Background(), "jobsService.GetAgents", func() {
resp, err = j.getAgents()
})
return resp, err
return j.getAgents()
}

func (j *jobsService) GetAgent(msg *apiv1.GetAgentRequest) *apiv1.GetAgentResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/tls"
"fmt"
"maps"
"runtime/trace"
"slices"
"time"

Expand Down Expand Up @@ -240,10 +239,7 @@ func (k *ResourceManager) GetJobQ(rpName rm.ResourcePoolName) (map[model.JobID]*
if err != nil {
return nil, err
}
var resp map[model.JobID]*sproto.RMJobInfo
trace.WithRegion(context.Background(), "resourcepool.GetJobQ", func() {
resp = rp.GetJobQ()
})
resp := rp.GetJobQ()
return resp, nil
}

Expand Down
8 changes: 1 addition & 7 deletions master/internal/rm/kubernetesrm/resource_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
"runtime/trace"
"sync"

"github.com/google/uuid"
Expand Down Expand Up @@ -128,16 +127,11 @@ func (k *kubernetesResourcePool) PendingPreemption(msg sproto.PendingPreemption)
}

func (k *kubernetesResourcePool) GetJobQ() map[model.JobID]*sproto.RMJobInfo {
// waiting on this lock
k.mu.Lock()
defer k.mu.Unlock()
k.tryAdmitPendingTasks = true

var resp map[model.JobID]*sproto.RMJobInfo
trace.WithRegion(context.Background(), "resourcepool.k8s.jobQInfo", func() {
resp = k.jobQInfo()
})
return resp
return k.jobQInfo()
}

func (k *kubernetesResourcePool) GetJobQStats() *jobv1.QueueStats {
Expand Down

0 comments on commit 707ad07

Please sign in to comment.