18098: Mention runtime engine (e.g., docker) in crunch-run log.
authorTom Clegg <tom@curii.com>
Wed, 22 Sep 2021 20:08:50 +0000 (16:08 -0400)
committerTom Clegg <tom@curii.com>
Wed, 22 Sep 2021 20:08:50 +0000 (16:08 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/crunchrun/crunchrun.go
lib/crunchrun/crunchrun_test.go
lib/crunchrun/docker.go
lib/crunchrun/executor.go
lib/crunchrun/singularity.go

index 01141674a6b329fc6ef4f0cb2feb6b60628e96e8..e540072a8ec017b634e3d116402929ab5735334e 100644 (file)
@@ -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 {
index bb982cdee76c32cb9321ce88e8fa47fa0588f2f1..9a8957e61b118710063e7fc5affe3728a502e824 100644 (file)
@@ -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"],
index 656061b77ec552a811c26dfe18be870b154c1b1e..07f79bbcc2d11f0239a6231288a94d84a89f87fb 100644 (file)
@@ -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)
index 65bf7427b9601c465fb21d811c5cb79d2d41a0f8..b7c341f3186b1af319780d19777d892be082a1cc 100644 (file)
@@ -58,4 +58,7 @@ type containerExecutor interface {
 
        // Release resources (temp dirs, stopped containers)
        Close()
+
+       // Name of runtime engine ("docker", "singularity")
+       Runtime() string
 }
index 61fecad0a13c06664890a9cf2dfffb8346b7a47e..99c5cef95c169155d9673b5e59c90f7f6d81e5a6 100644 (file)
@@ -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,