[ARVADOS] updated: 3c0ef3fc0cdb3f56d90442cc389ce4c2c94e8831
git at public.curoverse.com
git at public.curoverse.com
Wed Nov 4 15:03:05 EST 2015
Summary of changes:
sdk/go/arvadosclient/arvadosclient.go | 8 ++-
sdk/go/arvadosclient/arvadosclient_test.go | 80 ++++++++++++----------
.../arvnodeman/computenode/dispatch/__init__.py | 22 ++++--
.../arvnodeman/computenode/dispatch/slurm.py | 4 +-
services/nodemanager/arvnodeman/daemon.py | 14 +++-
.../nodemanager/tests/test_computenode_dispatch.py | 14 +++-
services/nodemanager/tests/test_daemon.py | 20 ++++++
7 files changed, 112 insertions(+), 50 deletions(-)
via 3c0ef3fc0cdb3f56d90442cc389ce4c2c94e8831 (commit)
via 3bef97ac46da8f5a7c322ec31c6bba4affb8ad80 (commit)
via 0a365f3d1a19fc27b402c9c742debf8975424b3f (commit)
via 242d3272391baeb95eb0a5e4e51627c2d54e7bc6 (commit)
from 59b22379a693d1fc15b4b77e58e47bac89e62660 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 3c0ef3fc0cdb3f56d90442cc389ce4c2c94e8831
Author: radhika <radhika at curoverse.com>
Date: Wed Nov 4 14:58:46 2015 -0500
5538: add test with a connection idle for longer than MaxIdleConnectionDuration
diff --git a/sdk/go/arvadosclient/arvadosclient.go b/sdk/go/arvadosclient/arvadosclient.go
index 1bc6f80..18e1074 100644
--- a/sdk/go/arvadosclient/arvadosclient.go
+++ b/sdk/go/arvadosclient/arvadosclient.go
@@ -26,7 +26,10 @@ var MissingArvadosApiHost = errors.New("Missing required environment variable AR
var MissingArvadosApiToken = errors.New("Missing required environment variable ARVADOS_API_TOKEN")
var ErrInvalidArgument = errors.New("Invalid argument")
-// Before a POST or DELERE request, close any connections that were idle for this long
+// A common failure mode is to reuse a keepalive connection that has been
+// terminated (in a way that we can't detect) for being idle too long.
+// POST and DELETE are not safe to retry automatically, so we minimize
+// such failures by always using a new or recently active socket.
var MaxIdleConnectionDuration = 30 * time.Second
// Indicates an error that was returned by the API server.
@@ -166,7 +169,8 @@ func (c ArvadosClient) CallRaw(method string, resourceType string, uuid string,
req.Header.Add("X-External-Client", "1")
}
- // Before a POST or DELETE, close any idle connections
+ // POST and DELETE are not safe to retry automatically, so we minimize
+ // such failures by always using a new or recently active socket
if method == "POST" || method == "DELETE" {
if time.Since(c.lastClosedIdlesAt) > MaxIdleConnectionDuration {
c.lastClosedIdlesAt = time.Now()
diff --git a/sdk/go/arvadosclient/arvadosclient_test.go b/sdk/go/arvadosclient/arvadosclient_test.go
index 2c508dc..36b3165 100644
--- a/sdk/go/arvadosclient/arvadosclient_test.go
+++ b/sdk/go/arvadosclient/arvadosclient_test.go
@@ -6,6 +6,7 @@ import (
"net/http"
"os"
"testing"
+ "time"
)
// Gocheck boilerplate
@@ -100,41 +101,50 @@ func (s *ServerRequiredSuite) TestInvalidResourceType(c *C) {
}
func (s *ServerRequiredSuite) TestCreatePipelineTemplate(c *C) {
- arv, err := MakeArvadosClient()
-
- getback := make(Dict)
- err = arv.Create("pipeline_templates",
- Dict{"pipeline_template": Dict{
- "name": "tmp",
- "components": Dict{
- "c1": map[string]string{"script": "script1"},
- "c2": map[string]string{"script": "script2"}}}},
- &getback)
- c.Assert(err, Equals, nil)
- c.Assert(getback["name"], Equals, "tmp")
- c.Assert(getback["components"].(map[string]interface{})["c2"].(map[string]interface{})["script"], Equals, "script2")
-
- uuid := getback["uuid"].(string)
-
- getback = make(Dict)
- err = arv.Get("pipeline_templates", uuid, nil, &getback)
- c.Assert(err, Equals, nil)
- c.Assert(getback["name"], Equals, "tmp")
- c.Assert(getback["components"].(map[string]interface{})["c1"].(map[string]interface{})["script"], Equals, "script1")
-
- getback = make(Dict)
- err = arv.Update("pipeline_templates", uuid,
- Dict{
- "pipeline_template": Dict{"name": "tmp2"}},
- &getback)
- c.Assert(err, Equals, nil)
- c.Assert(getback["name"], Equals, "tmp2")
-
- c.Assert(getback["uuid"].(string), Equals, uuid)
- getback = make(Dict)
- err = arv.Delete("pipeline_templates", uuid, nil, &getback)
- c.Assert(err, Equals, nil)
- c.Assert(getback["name"], Equals, "tmp2")
+ for _, idleConnections := range []bool{
+ false,
+ true,
+ } {
+ arv, err := MakeArvadosClient()
+
+ if idleConnections {
+ arv.lastClosedIdlesAt = time.Now().Add(-time.Minute)
+ }
+
+ getback := make(Dict)
+ err = arv.Create("pipeline_templates",
+ Dict{"pipeline_template": Dict{
+ "name": "tmp",
+ "components": Dict{
+ "c1": map[string]string{"script": "script1"},
+ "c2": map[string]string{"script": "script2"}}}},
+ &getback)
+ c.Assert(err, Equals, nil)
+ c.Assert(getback["name"], Equals, "tmp")
+ c.Assert(getback["components"].(map[string]interface{})["c2"].(map[string]interface{})["script"], Equals, "script2")
+
+ uuid := getback["uuid"].(string)
+
+ getback = make(Dict)
+ err = arv.Get("pipeline_templates", uuid, nil, &getback)
+ c.Assert(err, Equals, nil)
+ c.Assert(getback["name"], Equals, "tmp")
+ c.Assert(getback["components"].(map[string]interface{})["c1"].(map[string]interface{})["script"], Equals, "script1")
+
+ getback = make(Dict)
+ err = arv.Update("pipeline_templates", uuid,
+ Dict{
+ "pipeline_template": Dict{"name": "tmp2"}},
+ &getback)
+ c.Assert(err, Equals, nil)
+ c.Assert(getback["name"], Equals, "tmp2")
+
+ c.Assert(getback["uuid"].(string), Equals, uuid)
+ getback = make(Dict)
+ err = arv.Delete("pipeline_templates", uuid, nil, &getback)
+ c.Assert(err, Equals, nil)
+ c.Assert(getback["name"], Equals, "tmp2")
+ }
}
func (s *ServerRequiredSuite) TestErrorResponse(c *C) {
commit 3bef97ac46da8f5a7c322ec31c6bba4affb8ad80
Merge: 59b2237 0a365f3
Author: radhika <radhika at curoverse.com>
Date: Wed Nov 4 14:36:42 2015 -0500
Merge branch 'master' into 5538-close-idle-connections
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list