[ARVADOS] updated: 0a07e7988fe6e800d2f31620b19aa1ab0b1a344b

git at public.curoverse.com git at public.curoverse.com
Fri Nov 27 17:15:03 EST 2015


Summary of changes:
 sdk/go/keepclient/discover.go                      |  8 +++-
 sdk/go/keepclient/keepclient.go                    |  3 ++
 sdk/go/keepclient/keepclient_test.go               | 46 ++++++++++++++++++++++
 sdk/go/keepclient/support.go                       | 10 ++---
 .../arvados/v1/keep_services_controller.rb         |  2 +-
 5 files changed, 61 insertions(+), 8 deletions(-)

       via  0a07e7988fe6e800d2f31620b19aa1ab0b1a344b (commit)
      from  efc17768290cc63cf7be7b2bccfc5caa77720846 (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 0a07e7988fe6e800d2f31620b19aa1ab0b1a344b
Author: radhika <radhika at curoverse.com>
Date:   Fri Nov 27 17:13:17 2015 -0500

    7710: improve keepclient to use non-disk timeouts when any non-disk typed keepservices are found; previously, this was done for proxy typed keepservices only.

diff --git a/sdk/go/keepclient/discover.go b/sdk/go/keepclient/discover.go
index 650c2b5..1095085 100644
--- a/sdk/go/keepclient/discover.go
+++ b/sdk/go/keepclient/discover.go
@@ -111,6 +111,10 @@ func (this *KeepClient) loadKeepServers(list svcList) error {
 			}
 		}
 
+		if service.SvcType != "disk" {
+			this.foundNonDiskSvc = true
+		}
+
 		// Gateway services are only used when specified by
 		// UUID, so there's nothing to gain by filtering them
 		// by service type. Including all accessible services
@@ -119,8 +123,8 @@ func (this *KeepClient) loadKeepServers(list svcList) error {
 		gatewayRoots[service.Uuid] = url
 	}
 
-	if this.Using_proxy {
-		this.setClientSettingsProxy()
+	if this.foundNonDiskSvc {
+		this.setClientSettingsNonDisk()
 	} else {
 		this.setClientSettingsDisk()
 	}
diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index 0e6fadc..ddb502c 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -78,6 +78,9 @@ type KeepClient struct {
 
 	// set to 1 if all writable services are of disk type, otherwise 0
 	replicasPerService int
+
+	// Any non-disk typed services found in the list of keepservers?
+	foundNonDiskSvc bool
 }
 
 // MakeKeepClient creates a new KeepClient by contacting the API server to discover Keep servers.
diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index 4615ebc..2c77e68 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -16,6 +16,7 @@ import (
 	"os"
 	"strings"
 	"testing"
+	"time"
 )
 
 // Gocheck boilerplate
@@ -1245,3 +1246,48 @@ func (s *StandaloneSuite) TestPutBRetry(c *C) {
 	c.Check(hash, Equals, "")
 	c.Check(replicas, Equals, 2)
 }
+
+func (s *ServerRequiredSuite) TestMakeKeepClientWithNonDiskTypeService(c *C) {
+	arv, err := arvadosclient.MakeArvadosClient()
+	c.Assert(err, Equals, nil)
+
+	// Add an additional "testblobstore" keepservice
+	blobKeepService := make(arvadosclient.Dict)
+	err = arv.Create("keep_services",
+		arvadosclient.Dict{"keep_service": arvadosclient.Dict{
+			"service_host": "localhost",
+			"service_port": "21321",
+			"service_type": "testblobstore"}},
+		&blobKeepService)
+	c.Assert(err, Equals, nil)
+	defer func() { arv.Delete("keep_services", blobKeepService["uuid"].(string), nil, nil) }()
+
+	// Make a keepclient and ensure that the testblobstore is included
+	kc, err := MakeKeepClient(&arv)
+	c.Assert(err, Equals, nil)
+
+	// verify kc.LocalRoots
+	c.Check(len(kc.LocalRoots()), Equals, 3)
+	for _, root := range kc.LocalRoots() {
+		c.Check(root, Matches, "http://localhost:\\d+")
+	}
+	c.Assert(kc.LocalRoots()[blobKeepService["uuid"].(string)], NotNil)
+
+	// verify kc.GatewayRoots
+	c.Check(len(kc.GatewayRoots()), Equals, 3)
+	for _, root := range kc.GatewayRoots() {
+		c.Check(root, Matches, "http://localhost:\\d+")
+	}
+	c.Assert(kc.GatewayRoots()[blobKeepService["uuid"].(string)], NotNil)
+
+	// verify kc.WritableLocalRoots
+	c.Check(len(kc.WritableLocalRoots()), Equals, 3)
+	for _, root := range kc.WritableLocalRoots() {
+		c.Check(root, Matches, "http://localhost:\\d+")
+	}
+	c.Assert(kc.WritableLocalRoots()[blobKeepService["uuid"].(string)], NotNil)
+
+	c.Assert(kc.replicasPerService, Equals, 0)
+	c.Assert(kc.foundNonDiskSvc, Equals, true)
+	c.Assert(kc.Client.Timeout, Equals, 300*time.Second)
+}
diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go
index 90ac3bc..b904b09 100644
--- a/sdk/go/keepclient/support.go
+++ b/sdk/go/keepclient/support.go
@@ -34,9 +34,9 @@ func Md5String(s string) string {
 	return fmt.Sprintf("%x", md5.Sum([]byte(s)))
 }
 
-// Set timeouts apply when connecting to keepproxy services (assumed to be over
-// the Internet).
-func (this *KeepClient) setClientSettingsProxy() {
+// Set timeouts applicable when connecting to non-disk services
+// (assumed to be over the Internet).
+func (this *KeepClient) setClientSettingsNonDisk() {
 	if this.Client.Timeout == 0 {
 		// Maximum time to wait for a complete response
 		this.Client.Timeout = 300 * time.Second
@@ -58,8 +58,8 @@ func (this *KeepClient) setClientSettingsProxy() {
 	}
 }
 
-// Set timeouts apply when connecting to keepstore services directly (assumed
-// to be on the local network).
+// Set timeouts applicable when connecting to keepstore services directly
+// (assumed to be on the local network).
 func (this *KeepClient) setClientSettingsDisk() {
 	if this.Client.Timeout == 0 {
 		// Maximum time to wait for a complete response
diff --git a/services/api/app/controllers/arvados/v1/keep_services_controller.rb b/services/api/app/controllers/arvados/v1/keep_services_controller.rb
index fc2ee93..d2a512b 100644
--- a/services/api/app/controllers/arvados/v1/keep_services_controller.rb
+++ b/services/api/app/controllers/arvados/v1/keep_services_controller.rb
@@ -13,7 +13,7 @@ class Arvados::V1::KeepServicesController < ApplicationController
     if request.headers['X-External-Client'] == '1'
       @objects = model_class.where('service_type=?', 'proxy')
     else
-      @objects = model_class.where('service_type=?', 'disk')
+      @objects = model_class.where(model_class.arel_table[:service_type].not_eq('proxy'))
     end
     render_list
   end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list