Merge branch '16392-url-trailing-slash'
authorTom Clegg <tom@tomclegg.ca>
Wed, 13 May 2020 20:16:42 +0000 (16:16 -0400)
committerTom Clegg <tom@tomclegg.ca>
Wed, 13 May 2020 20:16:42 +0000 (16:16 -0400)
refs #16392

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

lib/boot/supervisor.go
sdk/cwl/arvados_cwl/runner.py
sdk/go/arvadosclient/pool.go
sdk/go/keepclient/discover.go
services/keep-web/handler.go

index c3dd4bf9b2599251f9df48d9c947e8dad80f39c7..e38a4775e87f799b3641ac9b50f524b6b9e2df99 100644 (file)
@@ -596,7 +596,7 @@ func (super *Supervisor) autofillConfig(cfg *arvados.Config) error {
                                svc == &cluster.Services.Workbench1 {
                                svc.ExternalURL = arvados.URL{Scheme: "https", Host: fmt.Sprintf("%s:%s", super.ListenHost, nextPort(super.ListenHost)), Path: "/"}
                        } else if svc == &cluster.Services.Websocket {
-                               svc.ExternalURL = arvados.URL{Scheme: "wss", Host: fmt.Sprintf("%s:%s", super.ListenHost, nextPort(super.ListenHost)), Path: "/"}
+                               svc.ExternalURL = arvados.URL{Scheme: "wss", Host: fmt.Sprintf("%s:%s", super.ListenHost, nextPort(super.ListenHost)), Path: "/websocket"}
                        }
                }
                if len(svc.InternalURLs) == 0 {
index f0be83032415bf64e0a64c793c8b0b7e9974bdd3..7bb66a158e50646f1fc984df7ea30ccd31528bf3 100644 (file)
@@ -42,6 +42,7 @@ import schema_salad.validate as validate
 import arvados.collection
 from .util import collectionUUID
 import ruamel.yaml as yaml
+from ruamel.yaml.comments import CommentedMap, CommentedSeq
 
 import arvados_cwl.arvdocker
 from .pathmapper import ArvPathMapper, trim_listing, collection_pdh_pattern, collection_uuid_pattern
@@ -392,7 +393,7 @@ def upload_dependencies(arvrunner, name, document_loader,
             discovered_secondaryfiles[mapper.mapper(d).resolved] = discovered[d]
 
     if "$schemas" in workflowobj:
-        sch = []
+        sch = CommentedSeq()
         for s in workflowobj["$schemas"]:
             sch.append(mapper.mapper(s).resolved)
         workflowobj["$schemas"] = sch
index 732080770b31bdbece62be480004b129c50cf4a4..bb7867aef7e35d283c5e47adb68873492bda609c 100644 (file)
@@ -6,6 +6,8 @@ package arvadosclient
 
 import (
        "sync"
+
+       "git.arvados.org/arvados.git/sdk/go/arvados"
 )
 
 // A ClientPool is a pool of ArvadosClients. This is useful for
@@ -14,7 +16,7 @@ import (
 // credentials. See arvados-git-httpd for an example, and sync.Pool
 // for more information about garbage collection.
 type ClientPool struct {
-       // Initialize new clients by coping this one.
+       // Initialize new clients by copying this one.
        Prototype *ArvadosClient
 
        pool      *sync.Pool
@@ -25,7 +27,20 @@ type ClientPool struct {
 // MakeClientPool returns a new empty ClientPool, using environment
 // variables to initialize the prototype.
 func MakeClientPool() *ClientPool {
-       proto, err := MakeArvadosClient()
+       return MakeClientPoolWith(nil)
+}
+
+// MakeClientPoolWith returns a new empty ClientPool with a previously
+// initialized arvados.Client.
+func MakeClientPoolWith(client *arvados.Client) *ClientPool {
+       var err error
+       var proto *ArvadosClient
+
+       if client == nil {
+               proto, err = MakeArvadosClient()
+       } else {
+               proto, err = New(client)
+       }
        return &ClientPool{
                Prototype: proto,
                lastErr:   err,
index 744ff826853895c1769a5865d8dbded75ddc1474..726c3fb30c88414cd7e3ea93841084bdfadf61f0 100644 (file)
@@ -19,7 +19,7 @@ import (
        "git.arvados.org/arvados.git/sdk/go/arvadosclient"
 )
 
-// ClearCache clears the Keep service discovery cache.
+// RefreshServiceDiscovery clears the Keep service discovery cache.
 func RefreshServiceDiscovery() {
        var wg sync.WaitGroup
        defer wg.Wait()
@@ -35,8 +35,8 @@ func RefreshServiceDiscovery() {
        }
 }
 
-// ClearCacheOnSIGHUP installs a signal handler that calls
-// ClearCache when SIGHUP is received.
+// RefreshServiceDiscoveryOnSIGHUP installs a signal handler that calls
+// RefreshServiceDiscovery when SIGHUP is received.
 func RefreshServiceDiscoveryOnSIGHUP() {
        svcListCacheMtx.Lock()
        defer svcListCacheMtx.Unlock()
index 563a59df014b8f642b545a68bc23f2e72e1a57d1..643ca4f587f51bc9b353ab29b4a82869d96578a8 100644 (file)
@@ -76,7 +76,9 @@ func parseCollectionIDFromURL(s string) string {
 }
 
 func (h *handler) setup() {
-       h.clientPool = arvadosclient.MakeClientPool()
+       // Errors will be handled at the client pool.
+       arv, _ := arvados.NewClientFromConfig(h.Config.cluster)
+       h.clientPool = arvadosclient.MakeClientPoolWith(arv)
 
        keepclient.RefreshServiceDiscoveryOnSIGHUP()
        keepclient.DefaultBlockCache.MaxBlocks = h.Config.cluster.Collections.WebDAVCache.MaxBlockEntries