@@ -10,7 +10,6 @@ import (
10
10
"k8s.io/apimachinery/pkg/api/errors"
11
11
"k8s.io/apimachinery/pkg/util/json"
12
12
"k8s.io/apimachinery/pkg/util/yaml"
13
- ctrl "sigs.k8s.io/controller-runtime"
14
13
15
14
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
16
15
)
@@ -31,7 +30,7 @@ type RayDashboardClientInterface interface {
31
30
GetJobInfo (ctx context.Context , jobId string ) (* RayJobInfo , error )
32
31
ListJobs (ctx context.Context ) (* []RayJobInfo , error )
33
32
SubmitJob (ctx context.Context , rayJob * rayv1.RayJob ) (string , error )
34
- SubmitJobReq (ctx context.Context , request * RayJobRequest , name * string ) (string , error )
33
+ SubmitJobReq (ctx context.Context , request * RayJobRequest ) (string , error )
35
34
GetJobLog (ctx context.Context , jobName string ) (* string , error )
36
35
StopJob (ctx context.Context , jobName string ) error
37
36
DeleteJob (ctx context.Context , jobName string ) error
@@ -72,7 +71,7 @@ func (r *RayDashboardClient) UpdateDeployments(ctx context.Context, configJson [
72
71
func (r * RayDashboardClient ) GetMultiApplicationStatus (ctx context.Context ) (map [string ]* ServeApplicationStatus , error ) {
73
72
serveDetails , err := r .GetServeDetails (ctx )
74
73
if err != nil {
75
- return nil , fmt .Errorf ("Failed to get serve details: %w" , err )
74
+ return nil , fmt .Errorf ("failed to get serve details: %w" , err )
76
75
}
77
76
78
77
return r .ConvertServeDetailsToApplicationStatuses (serveDetails )
@@ -111,12 +110,12 @@ func (r *RayDashboardClient) GetServeDetails(ctx context.Context) (*ServeDetails
111
110
func (r * RayDashboardClient ) ConvertServeDetailsToApplicationStatuses (serveDetails * ServeDetails ) (map [string ]* ServeApplicationStatus , error ) {
112
111
detailsJson , err := json .Marshal (serveDetails .Applications )
113
112
if err != nil {
114
- return nil , fmt .Errorf ("Failed to marshal serve details: %v" , serveDetails .Applications )
113
+ return nil , fmt .Errorf ("failed to marshal serve details: %v" , serveDetails .Applications )
115
114
}
116
115
117
116
applicationStatuses := map [string ]* ServeApplicationStatus {}
118
117
if err = json .Unmarshal (detailsJson , & applicationStatuses ); err != nil {
119
- return nil , fmt .Errorf ("Failed to unmarshal serve details bytes into map of application statuses: %w. Bytes: %s" , err , string (detailsJson ))
118
+ return nil , fmt .Errorf ("failed to unmarshal serve details bytes into map of application statuses: %w. Bytes: %s" , err , string (detailsJson ))
120
119
}
121
120
122
121
return applicationStatuses , nil
@@ -232,18 +231,14 @@ func (r *RayDashboardClient) SubmitJob(ctx context.Context, rayJob *rayv1.RayJob
232
231
if err != nil {
233
232
return "" , err
234
233
}
235
- return r .SubmitJobReq (ctx , request , & rayJob . Name )
234
+ return r .SubmitJobReq (ctx , request )
236
235
}
237
236
238
- func (r * RayDashboardClient ) SubmitJobReq (ctx context.Context , request * RayJobRequest , name * string ) (jobId string , err error ) {
239
- log := ctrl .LoggerFrom (ctx )
237
+ func (r * RayDashboardClient ) SubmitJobReq (ctx context.Context , request * RayJobRequest ) (jobId string , err error ) {
240
238
rayJobJson , err := json .Marshal (request )
241
239
if err != nil {
242
240
return
243
241
}
244
- if name != nil {
245
- log .Info ("Submit a ray job" , "rayJob" , name , "jobInfo" , string (rayJobJson ))
246
- }
247
242
248
243
req , err := http .NewRequestWithContext (ctx , http .MethodPost , r .dashboardURL + JobPath , bytes .NewBuffer (rayJobJson ))
249
244
if err != nil {
@@ -277,9 +272,6 @@ func (r *RayDashboardClient) SubmitJobReq(ctx context.Context, request *RayJobRe
277
272
278
273
// Get Job Log
279
274
func (r * RayDashboardClient ) GetJobLog (ctx context.Context , jobName string ) (* string , error ) {
280
- log := ctrl .LoggerFrom (ctx )
281
- log .Info ("Get ray job log" , "rayJob" , jobName )
282
-
283
275
req , err := http .NewRequestWithContext (ctx , http .MethodGet , r .dashboardURL + JobPath + jobName + "/logs" , nil )
284
276
if err != nil {
285
277
return nil , err
@@ -311,9 +303,6 @@ func (r *RayDashboardClient) GetJobLog(ctx context.Context, jobName string) (*st
311
303
}
312
304
313
305
func (r * RayDashboardClient ) StopJob (ctx context.Context , jobName string ) (err error ) {
314
- log := ctrl .LoggerFrom (ctx )
315
- log .Info ("Stop a ray job" , "rayJob" , jobName )
316
-
317
306
req , err := http .NewRequestWithContext (ctx , http .MethodPost , r .dashboardURL + JobPath + jobName + "/stop" , nil )
318
307
if err != nil {
319
308
return err
@@ -343,16 +332,13 @@ func (r *RayDashboardClient) StopJob(ctx context.Context, jobName string) (err e
343
332
}
344
333
// StopJob only returns an error when JobStatus is not in terminal states (STOPPED / SUCCEEDED / FAILED)
345
334
if ! rayv1 .IsJobTerminal (jobInfo .JobStatus ) {
346
- return fmt .Errorf ("Failed to stopped job: %v" , jobInfo )
335
+ return fmt .Errorf ("failed to stop job: %v" , jobInfo )
347
336
}
348
337
}
349
338
return nil
350
339
}
351
340
352
341
func (r * RayDashboardClient ) DeleteJob (ctx context.Context , jobName string ) error {
353
- log := ctrl .LoggerFrom (ctx )
354
- log .Info ("Delete a ray job" , "rayJob" , jobName )
355
-
356
342
req , err := http .NewRequestWithContext (ctx , http .MethodDelete , r .dashboardURL + JobPath + jobName , nil )
357
343
if err != nil {
358
344
return err
0 commit comments