[arvados] created: 2.5.0-4-g40d8256b9
git repository hosting
git at public.arvados.org
Thu Jan 12 21:53:58 UTC 2023
at 40d8256b92b5e2b64f1ea5a65a03e01e1763a6d9 (commit)
commit 40d8256b92b5e2b64f1ea5a65a03e01e1763a6d9
Author: Brett Smith <brett.smith at curii.com>
Date: Thu Jan 12 16:51:12 2023 -0500
19886: Save log collection when crunch-run starts a container
This allows users to see information about the node where the container
started, including through Workbench 2.
Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith at curii.com>
diff --git a/lib/crunchrun/crunchrun.go b/lib/crunchrun/crunchrun.go
index 52e1bf63a..d322a3ac3 100644
--- a/lib/crunchrun/crunchrun.go
+++ b/lib/crunchrun/crunchrun.go
@@ -1434,7 +1434,11 @@ func (runner *ContainerRunner) UpdateContainerRunning() error {
return ErrCancelled
}
return runner.DispatcherArvClient.Update("containers", runner.Container.UUID,
- arvadosclient.Dict{"container": arvadosclient.Dict{"state": "Running", "gateway_address": runner.gateway.Address}}, nil)
+ arvadosclient.Dict{"container": arvadosclient.Dict{
+ "state": "Running",
+ "gateway_address": runner.gateway.Address,
+ "log": runner.logUUID,
+ }}, nil)
}
// ContainerToken returns the api_token the container (and any
@@ -1625,6 +1629,10 @@ func (runner *ContainerRunner) Run() (err error) {
return
}
+ _, err = runner.saveLogCollection(false)
+ if err != nil {
+ runner.CrunchLog.Printf("Error committing initial log collection: %v", err)
+ }
err = runner.UpdateContainerRunning()
if err != nil {
return
diff --git a/lib/crunchrun/crunchrun_test.go b/lib/crunchrun/crunchrun_test.go
index 735385a6f..50ecb1973 100644
--- a/lib/crunchrun/crunchrun_test.go
+++ b/lib/crunchrun/crunchrun_test.go
@@ -896,6 +896,37 @@ func (s *TestSuite) TestLogVersionAndRuntime(c *C) {
c.Check(s.api.Logs["crunch-run"].String(), Matches, `(?ms).*Using container runtime: stub.*`)
}
+func (s *TestSuite) TestCommitNodeInfoBeforeStart(c *C) {
+ var collection_create, container_update arvadosclient.Dict
+ s.fullRunHelper(c, `{
+ "command": ["true"],
+ "container_image": "`+arvadostest.DockerImage112PDH+`",
+ "cwd": ".",
+ "environment": {},
+ "mounts": {"/tmp": {"kind": "tmp"} },
+ "output_path": "/tmp",
+ "priority": 1,
+ "runtime_constraints": {},
+ "state": "Locked",
+ "uuid": "zzzzz-dz642-202301121543210"
+ }`, nil, 0,
+ func() {
+ collection_create = s.api.CalledWith("ensure_unique_name", true)
+ container_update = s.api.CalledWith("container.state", "Running")
+ })
+
+ c.Assert(collection_create, NotNil)
+ c.Check(collection_create["collection"].(arvadosclient.Dict)["name"], Equals, "logs for zzzzz-dz642-202301121543210")
+ manifest_text := collection_create["collection"].(arvadosclient.Dict)["manifest_text"]
+ // We check that the file size is at least two digits as an easy way to
+ // check the file isn't empty.
+ c.Check(manifest_text, Matches, `\. .* \d+:\d{2,}:node-info\.txt .*\n`)
+ c.Check(manifest_text, Matches, `\. .* \d+:\d{2,}:node\.json .*\n`)
+
+ c.Assert(container_update, NotNil)
+ c.Check(container_update["container"].(arvadosclient.Dict)["log"], Matches, `zzzzz-4zz18-[0-9a-z]{15}`)
+}
+
func (s *TestSuite) TestContainerRecordLog(c *C) {
s.fullRunHelper(c, `{
"command": ["sleep", "1"],
commit 46d67baa4b8efa20102f79ccee99d41bbc579a39
Author: Brett Smith <brett.smith at curii.com>
Date: Thu Jan 12 16:48:12 2023 -0500
19886: Bugfix UUID generation in crunch-run tests
The previous code was generating UUIDs with a 30-character last part.
Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith at curii.com>
diff --git a/lib/crunchrun/crunchrun_test.go b/lib/crunchrun/crunchrun_test.go
index 8da933a73..735385a6f 100644
--- a/lib/crunchrun/crunchrun_test.go
+++ b/lib/crunchrun/crunchrun_test.go
@@ -188,9 +188,10 @@ func (client *ArvTestClient) Create(resourceType string,
if resourceType == "collections" && output != nil {
mt := parameters["collection"].(arvadosclient.Dict)["manifest_text"].(string)
+ md5sum := md5.Sum([]byte(mt))
outmap := output.(*arvados.Collection)
- outmap.PortableDataHash = fmt.Sprintf("%x+%d", md5.Sum([]byte(mt)), len(mt))
- outmap.UUID = fmt.Sprintf("zzzzz-4zz18-%15.15x", md5.Sum([]byte(mt)))
+ outmap.PortableDataHash = fmt.Sprintf("%x+%d", md5sum, len(mt))
+ outmap.UUID = fmt.Sprintf("zzzzz-4zz18-%015x", md5sum[:7])
}
return nil
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list