@@ -235,10 +235,12 @@ func (ssn *Session) Allocate(task *api.TaskInfo, hostname string) error {
235
235
if err := job .UpdateTaskStatus (task , api .Allocated ); err != nil {
236
236
glog .Errorf ("Failed to update task <%v/%v> status to %v in Session <%v>: %v" ,
237
237
task .Namespace , task .Name , api .Allocated , ssn .UID , err )
238
+ return err
238
239
}
239
240
} else {
240
241
glog .Errorf ("Failed to found Job <%s> in Session <%s> index when binding." ,
241
242
task .Job , ssn .UID )
243
+ return fmt .Errorf ("failed to find job %s" , task .Job )
242
244
}
243
245
244
246
task .NodeName = hostname
@@ -247,12 +249,14 @@ func (ssn *Session) Allocate(task *api.TaskInfo, hostname string) error {
247
249
if err := node .AddTask (task ); err != nil {
248
250
glog .Errorf ("Failed to add task <%v/%v> to node <%v> in Session <%v>: %v" ,
249
251
task .Namespace , task .Name , hostname , ssn .UID , err )
252
+ return err
250
253
}
251
254
glog .V (3 ).Infof ("After allocated Task <%v/%v> to Node <%v>: idle <%v>, used <%v>, releasing <%v>" ,
252
255
task .Namespace , task .Name , node .Name , node .Idle , node .Used , node .Releasing )
253
256
} else {
254
257
glog .Errorf ("Failed to found Node <%s> in Session <%s> index when binding." ,
255
258
hostname , ssn .UID )
259
+ return fmt .Errorf ("failed to find node %s" , hostname )
256
260
}
257
261
258
262
// Callbacks
@@ -269,6 +273,7 @@ func (ssn *Session) Allocate(task *api.TaskInfo, hostname string) error {
269
273
if err := ssn .dispatch (task ); err != nil {
270
274
glog .Errorf ("Failed to dispatch task <%v/%v>: %v" ,
271
275
task .Namespace , task .Name , err )
276
+ return err
272
277
}
273
278
}
274
279
}
0 commit comments