add error to call model (#539)

* add error to call model

closes #331

previously, for async this error was being masked completely even if it was
something useful like the image not existing. for sync, the error was returned
in the http request but now it's also being stored. this error itself can
cover a lot of landscape, it could be an error in getting a slot, pulling an
image, running a container, among other things. anyway, no longer being
masked. we can likely improve it in certain cases we run into in the future,
but it's open ended at the moment and not being masked like some errors in
sync http request returns (503 non-models.APIError) for now.

* tucks in callTrigger stuff to keep api clean
* adds swagger
* adds migration
* adds tests for datastore and agent to ensure behavior

* pull images before tests are ran

* gofmt migrations file
This commit is contained in:
Reed Allman
2017-11-28 11:21:39 -06:00
committed by GitHub
parent 10e17b1c4d
commit 892c843d87
11 changed files with 178 additions and 24 deletions

View File

@@ -181,7 +181,6 @@ func transformTimeout(e error, isRetriable bool) error {
}
func (a *agent) Submit(callI Call) error {
a.wg.Add(1)
defer a.wg.Done()
@@ -217,7 +216,7 @@ func (a *agent) Submit(callI Call) error {
defer slot.Close() // notify our slot is free once we're done
// TODO Start is checking the timer now, we could do it here, too.
err = call.Start(ctx, a)
err = call.Start(ctx)
if err != nil {
a.stats.Dequeue(callI.Model().AppName, callI.Model().Path)
return transformTimeout(err, true)
@@ -241,7 +240,7 @@ func (a *agent) Submit(callI Call) error {
// TODO: we need to allocate more time to store the call + logs in case the call timed out,
// but this could put us over the timeout if the call did not reply yet (need better policy).
ctx = opentracing.ContextWithSpan(context.Background(), span)
err = call.End(ctx, err, a)
err = call.End(ctx, err)
return transformTimeout(err, false)
}