Merge branch '17529-ec2-rate-limit'
authorTom Clegg <tom@curii.com>
Fri, 16 Apr 2021 13:40:25 +0000 (09:40 -0400)
committerTom Clegg <tom@curii.com>
Fri, 16 Apr 2021 13:40:25 +0000 (09:40 -0400)
fixes #17529

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

21 files changed:
.licenseignore
doc/admin/upgrading.html.textile.liquid
lib/config/config.default.yml
lib/config/export.go
lib/config/generated_config.go
lib/controller/auth_test.go
lib/controller/federation_test.go
lib/controller/handler.go
lib/controller/handler_test.go
lib/controller/integration_test.go
lib/controller/server_test.go
sdk/cwl/arvados_cwl/arvworkflow.py
sdk/cwl/tests/arvados-tests.yml
sdk/cwl/tests/wf/hello.txt [new file with mode: 0644]
sdk/cwl/tests/wf/indir1/hello2.txt [new file with mode: 0644]
sdk/cwl/tests/wf/trick_defaults2.cwl [new file with mode: 0644]
sdk/go/arvados/config.go
sdk/python/arvados/api.py
sdk/python/arvados/commands/put.py
sdk/python/tests/test_api.py
sdk/python/tests/test_arv_put.py

index 7ebc82667ce80565575029ff2df12fa44703297e..e3289aa7c79e5cb6dd825a3cecaadca977481987 100644 (file)
@@ -86,3 +86,5 @@ sdk/python/tests/fed-migrate/CWLFile
 sdk/python/tests/fed-migrate/*.cwl
 sdk/python/tests/fed-migrate/*.cwlex
 doc/install/*.xlsx
+sdk/cwl/tests/wf/hello.txt
+sdk/cwl/tests/wf/indir1/hello2.txt
\ No newline at end of file
index 03e5992d15e958d26beaf3885d0da114ddb2979d..52b71287b2c27af49537c9461255a1c6d6bac52f 100644 (file)
@@ -62,6 +62,10 @@ h3. Centos7 Python 3 dependency upgraded to python3
 
 Now that Python 3 is part of the base repository in CentOS 7, the Python 3 dependency for Centos7 Arvados packages was changed from SCL rh-python36 to python3.
 
+h3. ForceLegacyAPI14 option removed
+
+The ForceLegacyAPI14 configuration option has been removed. In the unlikely event it is mentioned in your config file, remove it to avoid "deprecated/unknown config" warning logs.
+
 h2(#v2_1_0). v2.1.0 (2020-10-13)
 
 "Upgrading from 2.0.0":#v2_0_0
index bcaa692ff48cc10f5a2631b84b8fc0ed361a8436..ca627d07e8147a7becead4322855d0eee508b266 100644 (file)
@@ -571,9 +571,6 @@ Clusters:
         # ID > Web application) and add your controller's /login URL
         # (e.g., "https://zzzzz.example.com/login") as an authorized
         # redirect URL.
-        #
-        # Incompatible with ForceLegacyAPI14. ProviderAppID must be
-        # blank.
         ClientID: ""
         ClientSecret: ""
 
@@ -1481,13 +1478,6 @@ Clusters:
       # this blank.
       SSHHelpHostSuffix: ""
 
-    # Bypass new (Arvados 1.5) API implementations, and hand off
-    # requests directly to Rails instead. This can provide a temporary
-    # workaround for clients that are incompatible with the new API
-    # implementation. Note that it also disables some new federation
-    # features and will be removed in a future release.
-    ForceLegacyAPI14: false
-
 # (Experimental) Restart services automatically when config file
 # changes are detected. Only supported by `arvados-server boot` in
 # dev/test mode.
index b6531c59d87dd329a24d0b43f22dfd738f9208d5..5c0e9f270071b81792179c525cb47fa567955104 100644 (file)
@@ -130,7 +130,6 @@ var whitelist = map[string]bool{
        "Containers.SupportedDockerImageFormats":              true,
        "Containers.SupportedDockerImageFormats.*":            true,
        "Containers.UsePreemptibleInstances":                  true,
-       "ForceLegacyAPI14":                                    false,
        "Git":                                                 false,
        "InstanceTypes":                                       true,
        "InstanceTypes.*":                                     true,
index 4787f4fab2475e7870b85ce6597a3dc215347134..1032663973991d2a3f6cc786e1818e5ff28192c0 100644 (file)
@@ -577,9 +577,6 @@ Clusters:
         # ID > Web application) and add your controller's /login URL
         # (e.g., "https://zzzzz.example.com/login") as an authorized
         # redirect URL.
-        #
-        # Incompatible with ForceLegacyAPI14. ProviderAppID must be
-        # blank.
         ClientID: ""
         ClientSecret: ""
 
@@ -1487,13 +1484,6 @@ Clusters:
       # this blank.
       SSHHelpHostSuffix: ""
 
-    # Bypass new (Arvados 1.5) API implementations, and hand off
-    # requests directly to Rails instead. This can provide a temporary
-    # workaround for clients that are incompatible with the new API
-    # implementation. Note that it also disables some new federation
-    # features and will be removed in a future release.
-    ForceLegacyAPI14: false
-
 # (Experimental) Restart services automatically when config file
 # changes are detected. Only supported by ` + "`" + `arvados-server boot` + "`" + ` in
 # dev/test mode.
index ad214b160591928892e75c0f6e1e805d4c9e3506..01990620f6094dd10063df7e5e9410e082cade36 100644 (file)
@@ -62,10 +62,9 @@ func (s *AuthSuite) SetUpTest(c *check.C) {
        s.fakeProvider.ValidClientSecret = "test#client/secret"
 
        cluster := &arvados.Cluster{
-               ClusterID:        "zhome",
-               PostgreSQL:       integrationTestCluster().PostgreSQL,
-               ForceLegacyAPI14: forceLegacyAPI14,
-               SystemRootToken:  arvadostest.SystemRootToken,
+               ClusterID:       "zhome",
+               PostgreSQL:      integrationTestCluster().PostgreSQL,
+               SystemRootToken: arvadostest.SystemRootToken,
        }
        cluster.TLS.Insecure = true
        cluster.API.MaxItemsPerResponse = 1000
index e3b2291bcef4481ff37159c2d3c8b79b744b03e6..f4cadd821b3d008d7ad8cdf68a402d9e7bd05092 100644 (file)
@@ -57,9 +57,8 @@ func (s *FederationSuite) SetUpTest(c *check.C) {
        c.Assert(s.remoteMock.Start(), check.IsNil)
 
        cluster := &arvados.Cluster{
-               ClusterID:        "zhome",
-               PostgreSQL:       integrationTestCluster().PostgreSQL,
-               ForceLegacyAPI14: forceLegacyAPI14,
+               ClusterID:  "zhome",
+               PostgreSQL: integrationTestCluster().PostgreSQL,
        }
        cluster.TLS.Insecure = true
        cluster.API.MaxItemsPerResponse = 1000
index 40f335e952d6d40820b5ac52d6c2b5ea92d9946c..578bfc7d24bd26b8417a1e1bdcda5b6ab7aafd14 100644 (file)
@@ -94,21 +94,18 @@ func (h *Handler) setup() {
        oidcAuthorizer := localdb.OIDCAccessTokenAuthorizer(h.Cluster, h.db)
        rtr := router.New(federation.New(h.Cluster), api.ComposeWrappers(ctrlctx.WrapCallsInTransactions(h.db), oidcAuthorizer.WrapCalls))
        mux.Handle("/arvados/v1/config", rtr)
-       mux.Handle("/"+arvados.EndpointUserAuthenticate.Path, rtr)
-
-       if !h.Cluster.ForceLegacyAPI14 {
-               mux.Handle("/arvados/v1/collections", rtr)
-               mux.Handle("/arvados/v1/collections/", rtr)
-               mux.Handle("/arvados/v1/users", rtr)
-               mux.Handle("/arvados/v1/users/", rtr)
-               mux.Handle("/arvados/v1/connect/", rtr)
-               mux.Handle("/arvados/v1/container_requests", rtr)
-               mux.Handle("/arvados/v1/container_requests/", rtr)
-               mux.Handle("/arvados/v1/groups", rtr)
-               mux.Handle("/arvados/v1/groups/", rtr)
-               mux.Handle("/login", rtr)
-               mux.Handle("/logout", rtr)
-       }
+       mux.Handle("/"+arvados.EndpointUserAuthenticate.Path, rtr) // must come before .../users/
+       mux.Handle("/arvados/v1/collections", rtr)
+       mux.Handle("/arvados/v1/collections/", rtr)
+       mux.Handle("/arvados/v1/users", rtr)
+       mux.Handle("/arvados/v1/users/", rtr)
+       mux.Handle("/arvados/v1/connect/", rtr)
+       mux.Handle("/arvados/v1/container_requests", rtr)
+       mux.Handle("/arvados/v1/container_requests/", rtr)
+       mux.Handle("/arvados/v1/groups", rtr)
+       mux.Handle("/arvados/v1/groups/", rtr)
+       mux.Handle("/login", rtr)
+       mux.Handle("/logout", rtr)
 
        hs := http.NotFoundHandler()
        hs = prepend(hs, h.proxyRailsAPI)
index d12e4fa33d32a72d8f9b5342c94aab84664fbe03..935208fc4e621c7c8040e09a1381e39c949e0232 100644 (file)
@@ -26,13 +26,9 @@ import (
        check "gopkg.in/check.v1"
 )
 
-var forceLegacyAPI14 bool
-
 // Gocheck boilerplate
 func Test(t *testing.T) {
-       for _, forceLegacyAPI14 = range []bool{false, true} {
-               check.TestingT(t)
-       }
+       check.TestingT(t)
 }
 
 var _ = check.Suite(&HandlerSuite{})
@@ -48,9 +44,8 @@ func (s *HandlerSuite) SetUpTest(c *check.C) {
        s.ctx, s.cancel = context.WithCancel(context.Background())
        s.ctx = ctxlog.Context(s.ctx, ctxlog.New(os.Stderr, "json", "debug"))
        s.cluster = &arvados.Cluster{
-               ClusterID:        "zzzzz",
-               PostgreSQL:       integrationTestCluster().PostgreSQL,
-               ForceLegacyAPI14: forceLegacyAPI14,
+               ClusterID:  "zzzzz",
+               PostgreSQL: integrationTestCluster().PostgreSQL,
        }
        s.cluster.API.RequestTimeout = arvados.Duration(5 * time.Minute)
        s.cluster.TLS.Insecure = true
@@ -198,10 +193,6 @@ func (s *HandlerSuite) TestLogoutSSO(c *check.C) {
 }
 
 func (s *HandlerSuite) TestLogoutGoogle(c *check.C) {
-       if s.cluster.ForceLegacyAPI14 {
-               // Google login N/A
-               return
-       }
        s.cluster.Login.Google.Enable = true
        s.cluster.Login.Google.ClientID = "test"
        req := httptest.NewRequest("GET", "https://0.0.0.0:1/logout?return_to=https://example.com/foo", nil)
index db1f7f0d0cee51b359c6d10f9ddd1e1b5de790e3..aeaede427ecf6c5106d86a890304418d5d8cb4c7 100644 (file)
@@ -37,11 +37,6 @@ type IntegrationSuite struct {
 }
 
 func (s *IntegrationSuite) SetUpSuite(c *check.C) {
-       if forceLegacyAPI14 {
-               c.Skip("heavy integration tests don't run with forceLegacyAPI14")
-               return
-       }
-
        cwd, _ := os.Getwd()
 
        s.oidcprovider = arvadostest.NewOIDCProvider(c)
index 838de35563e60fb1a994e8cee8c28dd2b9321fbe..e3558c3f41bec4b47c01b2575e4793fbbebb7674 100644 (file)
@@ -35,9 +35,8 @@ func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
        log := ctxlog.TestLogger(c)
 
        handler := &Handler{Cluster: &arvados.Cluster{
-               ClusterID:        "zzzzz",
-               PostgreSQL:       integrationTestCluster().PostgreSQL,
-               ForceLegacyAPI14: forceLegacyAPI14,
+               ClusterID:  "zzzzz",
+               PostgreSQL: integrationTestCluster().PostgreSQL,
        }}
        handler.Cluster.TLS.Insecure = true
        arvadostest.SetServiceURL(&handler.Cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
index 6067ae9f442b70c6d42db62df1581ab32a7cea37..4fe82a6fe1d6fc32f709dd909577da7010970e07 100644 (file)
@@ -17,7 +17,7 @@ from cwltool.pack import pack
 from cwltool.load_tool import fetch_document, resolve_and_validate_document
 from cwltool.process import shortname
 from cwltool.workflow import Workflow, WorkflowException, WorkflowStep
-from cwltool.utils import adjustFileObjs, adjustDirObjs, visit_class
+from cwltool.utils import adjustFileObjs, adjustDirObjs, visit_class, normalizeFilesDirs
 from cwltool.context import LoadingContext
 
 import ruamel.yaml as yaml
@@ -186,6 +186,7 @@ class ArvadosWorkflow(Workflow):
 
         discover_secondary_files(self.arvrunner.fs_access, builder,
                                  self.tool["inputs"], joborder)
+        normalizeFilesDirs(joborder)
 
         with Perf(metrics, "subworkflow upload_deps"):
             upload_dependencies(self.arvrunner,
index 668604f88470e18ea566d807301b712bfafa935e..48255f85756a67ed7fa6026940695c8652bdb41c 100644 (file)
       "size": 4
   tool: 17267-broken-schemas.cwl
   doc: "Test issue 17267 - inaccessible $schemas URL is not a fatal error"
+
+- job: null
+  output: {}
+  tool: wf/trick_defaults2.cwl
+  doc: "Test issue 17462 - secondary file objects on file defaults are not resolved"
diff --git a/sdk/cwl/tests/wf/hello.txt b/sdk/cwl/tests/wf/hello.txt
new file mode 100644 (file)
index 0000000..ce01362
--- /dev/null
@@ -0,0 +1 @@
+hello
diff --git a/sdk/cwl/tests/wf/indir1/hello2.txt b/sdk/cwl/tests/wf/indir1/hello2.txt
new file mode 100644 (file)
index 0000000..14be0d4
--- /dev/null
@@ -0,0 +1 @@
+hello2
diff --git a/sdk/cwl/tests/wf/trick_defaults2.cwl b/sdk/cwl/tests/wf/trick_defaults2.cwl
new file mode 100644 (file)
index 0000000..9f42922
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env cwl-runner
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+class: CommandLineTool
+cwlVersion: v1.0
+inputs:
+  inp1:
+    type: File
+    default:
+      class: File
+      location: hello.txt
+      secondaryFiles:
+        - class: Directory
+          location: indir1
+outputs: []
+baseCommand: 'true'
index 2fda7febe5348163c43fb3dc387aca6df971f362..c0170d1d7f53e61460e2e32155a250fe9ed62cc6 100644 (file)
@@ -266,8 +266,6 @@ type Cluster struct {
                SSHHelpHostSuffix      string
                IdleTimeout            Duration
        }
-
-       ForceLegacyAPI14 bool
 }
 
 type Volume struct {
index 315fc74a713f42fbee7b7b030c36576ed5426bc0..4fe3999f2c3098391f387f51fe96cc628bf1a790 100644 (file)
@@ -157,7 +157,7 @@ def http_cache(data_type):
     return cache.SafeHTTPCache(path, max_age=60*60*24*2)
 
 def api(version=None, cache=True, host=None, token=None, insecure=False,
-        request_id=None, timeout=5*60, **kwargs):
+        request_id=None, timeout=10, **kwargs):
     """Return an apiclient Resources object for an Arvados instance.
 
     :version:
index 616a94e903eba20794ac589e696b5eb7c14f50aa..9596a2dc2d26efcddebbd7921e32ff38ebdb7352 100644 (file)
@@ -77,8 +77,7 @@ Synonym for --stream.
 _group.add_argument('--stream', action='store_true',
                     help="""
 Store the file content and display the resulting manifest on
-stdout. Do not write the manifest to Keep or save a Collection object
-in Arvados.
+stdout. Do not save a Collection object in Arvados.
 """)
 
 _group.add_argument('--as-manifest', action='store_true', dest='manifest',
@@ -743,7 +742,7 @@ class ArvPutUploadJob(object):
 
     def _write_stdin(self, filename):
         output = self._local_collection.open(filename, 'wb')
-        self._write(sys.stdin, output)
+        self._write(sys.stdin.buffer, output)
         output.close()
 
     def _check_file(self, source, filename):
index 8d3142ab6aa49980babae66e255d2f183224109e..60183e06a352259530534bedf56da1bbba5c3443 100644 (file)
@@ -101,6 +101,12 @@ class ArvadosApiTest(run_test_server.TestCaseWithServers):
             text = "X" * maxsize
             arvados.api('v1').collections().create(body={"manifest_text": text}).execute()
 
+    # Checks for bug #17171
+    def test_default_request_timeout(self):
+        api = arvados.api('v1')
+        self.assertEqual(api._http.timeout, 10,
+            "Default timeout value should be 10")
+
     def test_ordered_json_model(self):
         mock_responses = {
             'arvados.humans.get': (
index a8c4a853cf9f35f94ab04a191bc0188de723f2ad..e75d39d8793ffb6032a8591a37d9d5da2168ba72 100644 (file)
@@ -912,7 +912,7 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
             [sys.executable, arv_put.__file__, '--stream'],
             stdin=subprocess.PIPE, stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT, env=self.ENVIRON)
-        pipe.stdin.write(b'stdin test\n')
+        pipe.stdin.write(b'stdin test\xa6\n')
         pipe.stdin.close()
         deadline = time.time() + 5
         while (pipe.poll() is None) and (time.time() < deadline):
@@ -924,7 +924,7 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
         elif returncode != 0:
             sys.stdout.write(pipe.stdout.read())
             self.fail("arv-put returned exit code {}".format(returncode))
-        self.assertIn('4a9c8b735dce4b5fa3acf221a0b13628+11',
+        self.assertIn('1cb671b355a0c23d5d1c61d59cdb1b2b+12',
                       pipe.stdout.read().decode())
 
     def test_sigint_logs_request_id(self):