16347: Merge branch 'main'
authorTom Clegg <tom@curii.com>
Tue, 19 Oct 2021 13:21:44 +0000 (09:21 -0400)
committerTom Clegg <tom@curii.com>
Tue, 19 Oct 2021 13:21:44 +0000 (09:21 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

doc/_includes/_install_debian_key.liquid
doc/install/singularity.html.textile.liquid
doc/sdk/python/sdk-python.html.textile.liquid
lib/crunchrun/singularity.go
sdk/cli/bin/arv
sdk/cwl/arvados_cwl/runner.py
sdk/python/arvados/commands/keepdocker.py

index 1d5f73a4d28ef9d6863832668f6a8474f756204d..b25674c8ce4db0af2d1a2aac3c181693b418d86c 100644 (file)
@@ -6,7 +6,7 @@ SPDX-License-Identifier: CC-BY-SA-3.0
 
 <notextile>
 <pre><code># <span class="userinput">apt-get --no-install-recommends install curl gnupg2</span>
-# <span class="userinput">curl https://apt.arvados.org/pubkey.gpg -o /etc/apt/trusted.gpg.d/arvados.asc</span>
+# <span class="userinput">curl -s https://apt.arvados.org/pubkey.gpg -o /etc/apt/trusted.gpg.d/arvados.asc</span>
 </code></pre>
 </notextile>
 
index bd990b491b77741172d59e773673d99d97fbdc1d..d843912e1ba61b082403b9555458c0c31a23af9c 100644 (file)
@@ -21,6 +21,10 @@ Arvados can be configured to use "Singularity":https://sylabs.io/singularity/ in
 ** The Docker ENTRYPOINT instruction is ignored.
 * Arvados is tested with Singularity version 3.7.4. Other versions may not work.
 
+*Notes*:
+
+* Docker images are converted on the fly by @mksquashfs@, which can consume a considerable amount of RAM. The RAM usage of mksquashfs can be restricted in @/etc/singularity/singularity.conf@ with a line like @mksquashfs mem = 512M@. The amount of memory made available for mksquashfs should be configured lower than the smallest amount of memory requested by a container on the cluster to avoid the conversion being killed for using too much memory.
+
 h2(#configuration). Configuration
 
 To use singularity, first make sure "Singularity is installed":https://sylabs.io/guides/3.7/user-guide/quick_start.html on your cloud worker image or SLURM/LSF compute nodes as applicable. Note @squashfs-tools@ is required.
index 09eaa8e552c8e6a887cc8e4ce5b0047928024bbc..435f70e7bfda47efa06ccebe0bdf2263a8a20f13 100644 (file)
@@ -18,7 +18,7 @@ If you are logged in to an Arvados VM, the Python SDK should be installed.
 
 To use the Python SDK elsewhere, you can install from PyPI or a distribution package.
 
-As of Arvados 2.1, the Python SDK requires Python 3.5+.  The last version to support Python 2.7 is Arvados 2.0.4.
+As of Arvados 2.2, the Python SDK requires Python 3.6+.  The last version to support Python 2.7 is Arvados 2.0.4.
 
 h2. Option 1: Install from a distribution package
 
index 70ad653b7d5a8934a49a33532789c4ee77da3e85..5af023a83dc2dc61506818c88ccfadc5b0c22514 100644 (file)
@@ -160,7 +160,22 @@ func (e *singularityExecutor) LoadImage(dockerImageID string, imageTarballPath s
                        return err
                }
 
+               // Set up a cache and tmp dir for singularity build
+               err = os.Mkdir(e.tmpdir+"/cache", 0700)
+               if err != nil {
+                       return err
+               }
+               defer os.RemoveAll(e.tmpdir + "/cache")
+               err = os.Mkdir(e.tmpdir+"/tmp", 0700)
+               if err != nil {
+                       return err
+               }
+               defer os.RemoveAll(e.tmpdir + "/tmp")
+
                build := exec.Command("singularity", "build", imageFilename, "docker-archive://"+e.tmpdir+"/image.tar")
+               build.Env = os.Environ()
+               build.Env = append(build.Env, "SINGULARITY_CACHEDIR="+e.tmpdir+"/cache")
+               build.Env = append(build.Env, "SINGULARITY_TMPDIR="+e.tmpdir+"/tmp")
                e.logf("%v", build.Args)
                out, err := build.CombinedOutput()
                // INFO:    Starting build...
index c9809fad6ab75e05ef20e716310a49a70ff07584..9d4a609377b3d0b6fe4eb9ed65d2a7df23a70f41 100755 (executable)
@@ -98,7 +98,7 @@ def init_config
 end
 
 
-subcommands = %w(copy create edit get keep pipeline run tag ws)
+subcommands = %w(copy create edit get keep tag ws)
 
 def exec_bin bin, opts
   bin_path = `which #{bin.shellescape}`.strip
@@ -116,7 +116,7 @@ def check_subcommands client, arvados, subcommand, global_opts, remaining_opts
     arv_edit client, arvados, global_opts, remaining_opts
   when 'get'
     arv_get client, arvados, global_opts, remaining_opts
-  when 'copy', 'tag', 'ws', 'run'
+  when 'copy', 'tag', 'ws'
     exec_bin "arv-#{subcommand}", remaining_opts
   when 'keep'
     @sub = remaining_opts.shift
index ada64ae69aa62f0c1e4487bd28160c071fb3d0a1..145f1ad7f9d7572f1f4074da514cd0ea0f771d3e 100644 (file)
@@ -184,7 +184,10 @@ def set_secondary(fsaccess, builder, inputschema, secondaryspec, primary, discov
             elif isinstance(pattern, dict):
                 specs.append(pattern)
             elif isinstance(pattern, str):
-                specs.append({"pattern": pattern, "required": sf.get("required")})
+                if builder.cwlVersion == "v1.0":
+                    specs.append({"pattern": pattern, "required": True})
+                else:
+                    specs.append({"pattern": pattern, "required": sf.get("required")})
             else:
                 raise SourceLine(primary["secondaryFiles"], i, validate.ValidationException).makeError(
                     "Expression must return list, object, string or null")
@@ -194,6 +197,9 @@ def set_secondary(fsaccess, builder, inputschema, secondaryspec, primary, discov
             if isinstance(sf, dict):
                 if sf.get("class") == "File":
                     pattern = None
+                    if sf.get("location") is None:
+                        raise SourceLine(primary["secondaryFiles"], i, validate.ValidationException).makeError(
+                            "File object is missing 'location': %s" % sf)
                     sfpath = sf["location"]
                     required = True
                 else:
index f3df4e3f393bc15090dab3de80def1b50c595cc3..537ea3a9459f2ede6e5b5c87eada9c15fc778554 100644 (file)
@@ -87,9 +87,9 @@ def popen_docker(cmd, *args, **kwargs):
     kwargs.setdefault('stdin', subprocess.PIPE)
     kwargs.setdefault('stdout', sys.stderr)
     try:
-        docker_proc = subprocess.Popen(['docker.io'] + cmd, *args, **kwargs)
-    except OSError:  # No docker.io in $PATH
         docker_proc = subprocess.Popen(['docker'] + cmd, *args, **kwargs)
+    except OSError:  # No docker in $PATH, try docker.io
+        docker_proc = subprocess.Popen(['docker.io'] + cmd, *args, **kwargs)
     if manage_stdin:
         docker_proc.stdin.close()
     return docker_proc
@@ -146,20 +146,18 @@ def docker_images():
     check_docker(list_proc, "images")
 
 def find_image_hashes(image_search, image_tag=None):
-    # Given one argument, search for Docker images with matching hashes,
-    # and return their full hashes in a set.
-    # Given two arguments, also search for a Docker image with the
-    # same repository and tag.  If one is found, return its hash in a
-    # set; otherwise, fall back to the one-argument hash search.
-    # Returns None if no match is found, or a hash search is ambiguous.
-    hash_search = image_search.lower()
-    hash_matches = set()
-    for image in docker_images():
-        if (image.repo == image_search) and (image.tag == image_tag):
-            return set([image.hash])
-        elif image.hash.startswith(hash_search):
-            hash_matches.add(image.hash)
-    return hash_matches
+    # Query for a Docker images with the repository and tag and return
+    # the image ids in a list.  Returns empty list if no match is
+    # found.
+
+    list_proc = popen_docker(['inspect', "%s%s" % (image_search, ":"+image_tag if image_tag else "")], stdout=subprocess.PIPE)
+
+    inspect = list_proc.stdout.read()
+    list_proc.stdout.close()
+
+    imageinfo = json.loads(inspect)
+
+    return [i["Id"] for i in imageinfo]
 
 def find_one_image_hash(image_search, image_tag=None):
     hashes = find_image_hashes(image_search, image_tag)