Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: scheduler/appengine/engine/tq/tq.go

Issue 2981143002: Add 'dsset' structure. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The LUCI Authors. 1 // Copyright 2017 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return 351 return
352 } 352 }
353 353
354 execCount, _ := strconv.Atoi(c.Request.Header.Get("X-AppEngine-TaskExecu tionCount")) 354 execCount, _ := strconv.Atoi(c.Request.Header.Get("X-AppEngine-TaskExecu tionCount"))
355 switch err = h.cb(c.Context, payload, execCount); { 355 switch err = h.cb(c.Context, payload, execCount); {
356 case err == nil: 356 case err == nil:
357 httpReply(c, true, 200, "OK") 357 httpReply(c, true, 200, "OK")
358 case transient.Tag.In(err): 358 case transient.Tag.In(err):
359 httpReply(c, false, 500, "Transient error: %s", err) 359 httpReply(c, false, 500, "Transient error: %s", err)
360 default: 360 default:
361 » » httpReply(c, false, 200, "Fatal error: %s", err) // return 200 t o stop retries 361 » » httpReply(c, false, 500, "Fatal error: %s", err) // return 200 t o stop retries
tandrii(chromium) 2017/07/21 13:42:52 btw, why this?
Vadim Sh. 2017/07/24 00:30:18 Forgot to undo before sending the CL :) Shouldn't
362 } 362 }
363 } 363 }
364 364
365 func httpReply(c *router.Context, ok bool, code int, msg string, args ...interfa ce{}) { 365 func httpReply(c *router.Context, ok bool, code int, msg string, args ...interfa ce{}) {
366 body := fmt.Sprintf(msg, args...) 366 body := fmt.Sprintf(msg, args...)
367 if !ok { 367 if !ok {
368 logging.Errorf(c.Context, "%s", body) 368 logging.Errorf(c.Context, "%s", body)
369 } 369 }
370 http.Error(c.Writer, body, code) 370 http.Error(c.Writer, body, code)
371 } 371 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return nil, fmt.Errorf("no task body given") 405 return nil, fmt.Errorf("no task body given")
406 } 406 }
407 407
408 task := reflect.New(tp.Elem()).Interface().(proto.Message) 408 task := reflect.New(tp.Elem()).Interface().(proto.Message)
409 if err := jsonpb.Unmarshal(bytes.NewReader(*env.Body), task); err != nil { 409 if err := jsonpb.Unmarshal(bytes.NewReader(*env.Body), task); err != nil {
410 return nil, err 410 return nil, err
411 } 411 }
412 412
413 return task, nil 413 return task, nil
414 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698