| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package apiservers | 5 package apiservers |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "github.com/luci/luci-go/scheduler/api/scheduler/v1" | 8 "github.com/luci/luci-go/scheduler/api/scheduler/v1" |
| 9 "github.com/luci/luci-go/scheduler/appengine/catalog" | 9 "github.com/luci/luci-go/scheduler/appengine/catalog" |
| 10 "github.com/luci/luci-go/scheduler/appengine/engine" | 10 "github.com/luci/luci-go/scheduler/appengine/engine" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 jobs[i] = &scheduler.Job{ | 52 jobs[i] = &scheduler.Job{ |
| 53 JobRef: &scheduler.JobRef{ | 53 JobRef: &scheduler.JobRef{ |
| 54 Project: ej.ProjectID, | 54 Project: ej.ProjectID, |
| 55 Job: ej.GetJobName(), | 55 Job: ej.GetJobName(), |
| 56 }, | 56 }, |
| 57 Schedule: ej.Schedule, | 57 Schedule: ej.Schedule, |
| 58 State: &scheduler.JobState{ | 58 State: &scheduler.JobState{ |
| 59 UiStatus: string(presentation.GetPublicStateKind
(ej, traits)), | 59 UiStatus: string(presentation.GetPublicStateKind
(ej, traits)), |
| 60 }, | 60 }, |
| 61 Paused: ej.Paused, |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 return &scheduler.JobsReply{Jobs: jobs, NextCursor: ""}, nil | 64 return &scheduler.JobsReply{Jobs: jobs, NextCursor: ""}, nil |
| 64 } | 65 } |
| 65 | 66 |
| 66 func (s SchedulerServer) GetInvocations(ctx context.Context, in *scheduler.Invoc
ationsRequest) (*scheduler.InvocationsReply, error) { | 67 func (s SchedulerServer) GetInvocations(ctx context.Context, in *scheduler.Invoc
ationsRequest) (*scheduler.InvocationsReply, error) { |
| 67 ejob, err := s.Engine.GetJob(ctx, getJobId(in.GetJobRef())) | 68 ejob, err := s.Engine.GetJob(ctx, getJobId(in.GetJobRef())) |
| 68 if err != nil { | 69 if err != nil { |
| 69 return nil, grpc.Errorf(codes.Internal, "datastore error: %s", e
rr) | 70 return nil, grpc.Errorf(codes.Internal, "datastore error: %s", e
rr) |
| 70 } | 71 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 case err == engine.ErrNoSuchInvocation: | 147 case err == engine.ErrNoSuchInvocation: |
| 147 return nil, grpc.Errorf(codes.NotFound, "no such invocation") | 148 return nil, grpc.Errorf(codes.NotFound, "no such invocation") |
| 148 default: | 149 default: |
| 149 return nil, grpc.Errorf(codes.Internal, "internal error: %s", er
r) | 150 return nil, grpc.Errorf(codes.Internal, "internal error: %s", er
r) |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 | 153 |
| 153 func getJobId(jobRef *scheduler.JobRef) string { | 154 func getJobId(jobRef *scheduler.JobRef) string { |
| 154 return jobRef.GetProject() + "/" + jobRef.GetJob() | 155 return jobRef.GetProject() + "/" + jobRef.GetJob() |
| 155 } | 156 } |
| OLD | NEW |