[ARVADOS] created: 2.1.0-1386-g65857a417

Git user git at public.arvados.org
Wed Sep 22 20:10:35 UTC 2021


        at  65857a417f6a40e5323177a62386c684814f1fca (commit)


commit 65857a417f6a40e5323177a62386c684814f1fca
Author: Tom Clegg <tom at curii.com>
Date:   Wed Sep 22 16:08:50 2021 -0400

    18098: Mention runtime engine (e.g., docker) in crunch-run log.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/crunchrun/crunchrun.go b/lib/crunchrun/crunchrun.go
index 01141674a..e540072a8 100644
--- a/lib/crunchrun/crunchrun.go
+++ b/lib/crunchrun/crunchrun.go
@@ -1377,7 +1377,7 @@ func (runner *ContainerRunner) NewArvLogWriter(name string) (io.WriteCloser, err
 // Run the full container lifecycle.
 func (runner *ContainerRunner) Run() (err error) {
 	runner.CrunchLog.Printf("crunch-run %s started", cmd.Version.String())
-	runner.CrunchLog.Printf("Executing container '%s'", runner.Container.UUID)
+	runner.CrunchLog.Printf("Executing container '%s' using %s runtime", runner.Container.UUID, runner.executor.Runtime())
 
 	hostname, hosterr := os.Hostname()
 	if hosterr != nil {
diff --git a/lib/crunchrun/crunchrun_test.go b/lib/crunchrun/crunchrun_test.go
index bb982cdee..9a8957e61 100644
--- a/lib/crunchrun/crunchrun_test.go
+++ b/lib/crunchrun/crunchrun_test.go
@@ -117,6 +117,7 @@ func (e *stubExecutor) LoadImage(imageId string, tarball string, container arvad
 	e.loaded = tarball
 	return e.loadErr
 }
+func (e *stubExecutor) Runtime() string                 { return "stub" }
 func (e *stubExecutor) Create(spec containerSpec) error { e.created = spec; return e.createErr }
 func (e *stubExecutor) Start() error                    { e.exit = make(chan int, 1); go e.runFunc(); return e.startErr }
 func (e *stubExecutor) CgroupID() string                { return "cgroupid" }
@@ -849,6 +850,26 @@ func (s *TestSuite) TestNodeInfoLog(c *C) {
 	c.Check(json, Matches, `(?ms).*Disk INodes.*`)
 }
 
+func (s *TestSuite) TestLogVersionAndRuntime(c *C) {
+	s.fullRunHelper(c, `{
+		"command": ["sleep", "1"],
+		"container_image": "`+arvadostest.DockerImage112PDH+`",
+		"cwd": ".",
+		"environment": {},
+		"mounts": {"/tmp": {"kind": "tmp"} },
+		"output_path": "/tmp",
+		"priority": 1,
+		"runtime_constraints": {},
+		"state": "Locked"
+	}`, nil, 0,
+		func() {
+		})
+
+	c.Assert(s.api.Logs["crunch-run"], NotNil)
+	c.Check(s.api.Logs["crunch-run"].String(), Matches, `(?ms).*crunch-run \S+ \(go\S+\) start.*`)
+	c.Check(s.api.Logs["crunch-run"].String(), Matches, `(?ms).*Executing container 'zzzzz-zzzzz-zzzzzzzzzzzzzzz' using stub runtime.*`)
+}
+
 func (s *TestSuite) TestContainerRecordLog(c *C) {
 	s.fullRunHelper(c, `{
 		"command": ["sleep", "1"],
diff --git a/lib/crunchrun/docker.go b/lib/crunchrun/docker.go
index 656061b77..07f79bbcc 100644
--- a/lib/crunchrun/docker.go
+++ b/lib/crunchrun/docker.go
@@ -46,6 +46,8 @@ func newDockerExecutor(containerUUID string, logf func(string, ...interface{}),
 	}, err
 }
 
+func (e *dockerExecutor) Runtime() string { return "docker" }
+
 func (e *dockerExecutor) LoadImage(imageID string, imageTarballPath string, container arvados.Container, arvMountPoint string,
 	containerClient *arvados.Client) error {
 	_, _, err := e.dockerclient.ImageInspectWithRaw(context.TODO(), imageID)
diff --git a/lib/crunchrun/executor.go b/lib/crunchrun/executor.go
index 65bf7427b..b7c341f31 100644
--- a/lib/crunchrun/executor.go
+++ b/lib/crunchrun/executor.go
@@ -58,4 +58,7 @@ type containerExecutor interface {
 
 	// Release resources (temp dirs, stopped containers)
 	Close()
+
+	// Name of runtime engine ("docker", "singularity")
+	Runtime() string
 }
diff --git a/lib/crunchrun/singularity.go b/lib/crunchrun/singularity.go
index 61fecad0a..99c5cef95 100644
--- a/lib/crunchrun/singularity.go
+++ b/lib/crunchrun/singularity.go
@@ -36,6 +36,8 @@ func newSingularityExecutor(logf func(string, ...interface{})) (*singularityExec
 	}, nil
 }
 
+func (e *singularityExecutor) Runtime() string { return "singularity" }
+
 func (e *singularityExecutor) getOrCreateProject(ownerUuid string, name string, containerClient *arvados.Client) (*arvados.Group, error) {
 	var gp arvados.GroupList
 	err := containerClient.RequestAndDecode(&gp,

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list