Merge branch '18259-singularity-doc'
authorWard Vandewege <ward@curii.com>
Fri, 8 Oct 2021 21:36:09 +0000 (17:36 -0400)
committerWard Vandewege <ward@curii.com>
Fri, 8 Oct 2021 21:36:09 +0000 (17:36 -0400)
refs #18259

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

doc/sdk/python/sdk-python.html.textile.liquid
lib/crunchrun/singularity.go
sdk/cwl/arvados_cwl/runner.py

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 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: