[ARVADOS] updated: 1.2.0-115-gcd52bc7ce

Git user git at public.curoverse.com
Tue Oct 2 16:51:09 EDT 2018


Summary of changes:
 doc/api/methods/containers.html.textile.liquid |  2 +-
 lib/controller/federation.go                   | 22 +++-------------
 lib/controller/federation_test.go              |  8 +++---
 sdk/go/arvados/config.go                       | 36 +++++++++++++++++++-------
 4 files changed, 37 insertions(+), 31 deletions(-)

       via  cd52bc7ce67cb315e9d6175df4c750e190b9207e (commit)
      from  cdaca3963cf2d07e81eb71ac33e4c0966dec9b93 (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 cd52bc7ce67cb315e9d6175df4c750e190b9207e
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Tue Oct 2 16:50:07 2018 -0400

    13619: Move configuration options to arvados.Cluster.RequestLimits
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/doc/api/methods/containers.html.textile.liquid b/doc/api/methods/containers.html.textile.liquid
index cf92fef42..6e11efa64 100644
--- a/doc/api/methods/containers.html.textile.liquid
+++ b/doc/api/methods/containers.html.textile.liquid
@@ -92,7 +92,7 @@ See "Common resource methods":{{site.baseurl}}/api/methods.html for more informa
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
-Supports federated @create@, @delete@, @get@, @list@, and @update at .
+Supports federated @get@ and @list at .
 
 h2(#create). create
 
diff --git a/lib/controller/federation.go b/lib/controller/federation.go
index 51b3107ea..5c6f6bf7a 100644
--- a/lib/controller/federation.go
+++ b/lib/controller/federation.go
@@ -213,20 +213,6 @@ func (h *genericFederatedRequestHandler) remoteQueryUUIDs(w http.ResponseWriter,
 	return rp, kind, nil
 }
 
-func (h *Handler) FederatedRequestConcurrency() int {
-	if h.Cluster.FederatedRequestConcurrency == 0 {
-		return 4
-	}
-	return h.Cluster.FederatedRequestConcurrency
-}
-
-func (h *Handler) MaxItemsPerResponse() int {
-	if h.Cluster.MaxItemsPerResponse == 0 {
-		return 1000
-	}
-	return h.Cluster.MaxItemsPerResponse
-}
-
 func (h *genericFederatedRequestHandler) handleMultiClusterQuery(w http.ResponseWriter,
 	req *http.Request, clusterId *string) bool {
 
@@ -292,9 +278,9 @@ func (h *genericFederatedRequestHandler) handleMultiClusterQuery(w http.Response
 		httpserver.Error(w, "Federated multi-object may not provide 'limit', 'offset' or 'order'.", http.StatusBadRequest)
 		return true
 	}
-	if expectCount > h.handler.MaxItemsPerResponse() {
+	if expectCount > h.handler.Cluster.RequestLimits.GetMaxItemsPerResponse() {
 		httpserver.Error(w, fmt.Sprintf("Federated multi-object request for %v objects which is more than max page size %v.",
-			expectCount, h.handler.MaxItemsPerResponse()), http.StatusBadRequest)
+			expectCount, h.handler.Cluster.RequestLimits.GetMaxItemsPerResponse()), http.StatusBadRequest)
 		return true
 	}
 	if req.Form.Get("select") != "" {
@@ -322,7 +308,7 @@ func (h *genericFederatedRequestHandler) handleMultiClusterQuery(w http.Response
 
 	// use channel as a semaphore to limit the number of concurrent
 	// requests at a time
-	sem := make(chan bool, h.handler.FederatedRequestConcurrency())
+	sem := make(chan bool, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
 	defer close(sem)
 	wg := sync.WaitGroup{}
 
@@ -666,7 +652,7 @@ func (h *collectionFederatedRequestHandler) ServeHTTP(w http.ResponseWriter, req
 
 	// use channel as a semaphore to limit the number of concurrent
 	// requests at a time
-	sem := make(chan bool, h.handler.FederatedRequestConcurrency())
+	sem := make(chan bool, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
 	defer close(sem)
 	for remoteID := range h.handler.Cluster.RemoteClusters {
 		// blocks until it can put a value into the
diff --git a/lib/controller/federation_test.go b/lib/controller/federation_test.go
index 1b099be5e..23d5d7ca7 100644
--- a/lib/controller/federation_test.go
+++ b/lib/controller/federation_test.go
@@ -63,8 +63,10 @@ func (s *FederationSuite) SetUpTest(c *check.C) {
 		NodeProfiles: map[string]arvados.NodeProfile{
 			"*": nodeProfile,
 		},
-		MaxItemsPerResponse:         1000,
-		FederatedRequestConcurrency: 4,
+		RequestLimits: arvados.RequestLimits{
+			MaxItemsPerResponse:            1000,
+			MultiClusterRequestConcurrency: 4,
+		},
 	}, NodeProfile: &nodeProfile}
 	s.testServer = newServerFromIntegrationTestEnv(c)
 	s.testServer.Server.Handler = httpserver.AddRequestIDs(httpserver.LogRequests(s.log, s.testHandler))
@@ -722,7 +724,7 @@ func (s *FederationSuite) TestListMultiRemoteContainersMissing(c *check.C) {
 }
 
 func (s *FederationSuite) TestListMultiRemoteContainerPageSizeError(c *check.C) {
-	s.testHandler.Cluster.MaxItemsPerResponse = 1
+	s.testHandler.Cluster.RequestLimits.MaxItemsPerResponse = 1
 	req := httptest.NewRequest("GET", fmt.Sprintf("/arvados/v1/containers?count=none&filters=%s",
 		url.QueryEscape(fmt.Sprintf(`[["uuid", "in", ["%v", "zhome-xvhdp-cr5queuedcontnr"]]]`,
 			arvadostest.QueuedContainerUUID))),
diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go
index 7101693f3..c723be7d1 100644
--- a/sdk/go/arvados/config.go
+++ b/sdk/go/arvados/config.go
@@ -50,16 +50,20 @@ func (sc *Config) GetCluster(clusterID string) (*Cluster, error) {
 	}
 }
 
+type RequestLimits struct {
+	MaxItemsPerResponse            int
+	MultiClusterRequestConcurrency int
+}
+
 type Cluster struct {
-	ClusterID                   string `json:"-"`
-	ManagementToken             string
-	NodeProfiles                map[string]NodeProfile
-	InstanceTypes               InstanceTypeMap
-	HTTPRequestTimeout          Duration
-	RemoteClusters              map[string]RemoteCluster
-	PostgreSQL                  PostgreSQL
-	MaxItemsPerResponse         int
-	FederatedRequestConcurrency int
+	ClusterID          string `json:"-"`
+	ManagementToken    string
+	NodeProfiles       map[string]NodeProfile
+	InstanceTypes      InstanceTypeMap
+	HTTPRequestTimeout Duration
+	RemoteClusters     map[string]RemoteCluster
+	PostgreSQL         PostgreSQL
+	RequestLimits      RequestLimits
 }
 
 type PostgreSQL struct {
@@ -194,6 +198,20 @@ func (np *NodeProfile) ServicePorts() map[ServiceName]string {
 	}
 }
 
+func (h RequestLimits) GetMultiClusterRequestConcurrency() int {
+	if h.MultiClusterRequestConcurrency == 0 {
+		return 4
+	}
+	return h.MultiClusterRequestConcurrency
+}
+
+func (h RequestLimits) GetMaxItemsPerResponse() int {
+	if h.MaxItemsPerResponse == 0 {
+		return 1000
+	}
+	return h.MaxItemsPerResponse
+}
+
 type SystemServiceInstance struct {
 	Listen   string
 	TLS      bool

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list