[ARVADOS] updated: 2.1.0-487-gbd175fc52

Git user git at public.arvados.org
Tue Mar 16 15:26:18 UTC 2021


Summary of changes:
 build/run-tests.sh                    | 2 +-
 lib/crunchrun/container_exec_types.go | 4 ++++
 lib/crunchrun/crunchrun.go            | 6 +++---
 lib/crunchrun/crunchrun_test.go       | 8 ++++----
 lib/crunchrun/docker_adapter.go       | 7 +++++++
 lib/crunchrun/singularity.go          | 8 ++++++++
 6 files changed, 27 insertions(+), 8 deletions(-)

       via  bd175fc5207cfa7bf30ca62e2ef830192059ba68 (commit)
      from  c1d1f0502b8a0f049dba41da2f6b19a0d4b03d77 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit bd175fc5207cfa7bf30ca62e2ef830192059ba68
Author: Nico Cesar <nico at nicocesar.com>
Date:   Tue Mar 16 11:25:25 2021 -0400

    Added getImage() setImage() to the ThinContainerExecRunner interface
    
    Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>

diff --git a/build/run-tests.sh b/build/run-tests.sh
index d6dc43416..4a2a12c17 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -964,7 +964,7 @@ install_services/api() {
         set -ex
         cd "$WORKSPACE/services/api"
         export RAILS_ENV=test
-        if "$bundle" exec rails db:environment:set ; then
+        if bin/rails db:environment:set ; then
             "$bundle" exec rake db:drop
         fi
         "$bundle" exec rake db:setup
diff --git a/lib/crunchrun/container_exec_types.go b/lib/crunchrun/container_exec_types.go
index cc78a29df..fc865af73 100644
--- a/lib/crunchrun/container_exec_types.go
+++ b/lib/crunchrun/container_exec_types.go
@@ -19,6 +19,7 @@ import (
 // "It should hold only portable information about the container."
 // and for Singularity TBD
 type ContainerConfig struct {
+	Image        string
 	OpenStdin    bool
 	StdinOnce    bool
 	AttachStdin  bool
@@ -280,6 +281,9 @@ type ThinContainerExecRunner interface {
 	GetContainerConfig() (ContainerConfig, error)
 	GetHostConfig() (HostConfig, error)
 
+	GetImage() (imageID string)
+	SetImage(imageID string)
+
 	ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (HijackedResponse, error)
 	ContainerCreate(ctx context.Context, config ContainerConfig, hostConfig HostConfig, networkingConfig *NetworkingConfig, containerName string) (ContainerCreateResponse, error)
 	ContainerStart(ctx context.Context, container string, options ContainerStartOptions) error
diff --git a/lib/crunchrun/crunchrun.go b/lib/crunchrun/crunchrun.go
index fb6aaee99..ad10b6f9c 100644
--- a/lib/crunchrun/crunchrun.go
+++ b/lib/crunchrun/crunchrun.go
@@ -98,8 +98,8 @@ type ContainerRunner struct {
 	ContainerExecRunner ThinContainerExecRunner
 
 	//Docker          ThinDockerClient
-	ContainerConfig dockercontainer.Config     //FIXME: translate this to the ThinContainerRunner interface
-	HostConfig      dockercontainer.HostConfig //FIXME: translate this to the ThinContainerRunner interface
+	//ContainerConfig dockercontainer.Config     //FIXME: translate this to the ThinContainerRunner interface
+	HostConfig dockercontainer.HostConfig //FIXME: translate this to the ThinContainerRunner interface
 	//--------------
 
 	// Dispatcher client is initialized with the Dispatcher token.
@@ -311,7 +311,7 @@ func (runner *ContainerRunner) LoadImage() (err error) {
 		runner.CrunchLog.Print("Docker image is available")
 	}
 
-	runner.ContainerConfig.Image = imageID
+	runner.ContainerExecRunner.SetImage(imageID)
 
 	runner.ContainerKeepClient.ClearBlockCache()
 
diff --git a/lib/crunchrun/crunchrun_test.go b/lib/crunchrun/crunchrun_test.go
index ddf40543e..08f3a938d 100644
--- a/lib/crunchrun/crunchrun_test.go
+++ b/lib/crunchrun/crunchrun_test.go
@@ -457,7 +457,7 @@ func (s *TestSuite) TestLoadImage(c *C) {
 
 	// (1) Test loading image from keep
 	c.Check(kc.Called, Equals, false)
-	c.Check(cr.ContainerConfig.Image, Equals, "")
+	c.Check(cr.ContainerExecRunner.GetImage(), Equals, "")
 
 	err = cr.LoadImage()
 
@@ -467,19 +467,19 @@ func (s *TestSuite) TestLoadImage(c *C) {
 	}()
 
 	c.Check(kc.Called, Equals, true)
-	c.Check(cr.ContainerConfig.Image, Equals, hwImageID)
+	c.Check(cr.ContainerExecRunner.GetImage(), Equals, hwImageID)
 
 	_, _, err = cr.ContainerExecRunner.ImageInspectWithRaw(nil, hwImageID)
 	c.Check(err, IsNil)
 
 	// (2) Test using image that's already loaded
 	kc.Called = false
-	cr.ContainerConfig.Image = ""
+	cr.ContainerExecRunner.SetImage("")
 
 	err = cr.LoadImage()
 	c.Check(err, IsNil)
 	c.Check(kc.Called, Equals, false)
-	c.Check(cr.ContainerConfig.Image, Equals, hwImageID)
+	c.Check(cr.ContainerExecRunner.GetImage(), Equals, hwImageID)
 
 }
 
diff --git a/lib/crunchrun/docker_adapter.go b/lib/crunchrun/docker_adapter.go
index 795d06b56..1019e7df7 100644
--- a/lib/crunchrun/docker_adapter.go
+++ b/lib/crunchrun/docker_adapter.go
@@ -211,6 +211,13 @@ func (a *DockerAdapter) GetContainerConfig() (ContainerConfig, error) {
 func (a *DockerAdapter) GetHostConfig() (HostConfig, error) {
 	return a.hostConfig, nil
 }
+func (a *DockerAdapter) GetImage() (imageID string) {
+	return a.containerConfig.Image
+}
+
+func (a *DockerAdapter) SetImage(imageID string) {
+	a.containerConfig.Image = imageID
+}
 
 func adapter(docker ThinDockerClient) ThinContainerExecRunner {
 	return_object := &DockerAdapter{docker: docker}
diff --git a/lib/crunchrun/singularity.go b/lib/crunchrun/singularity.go
index 91ec0ea11..6b36e6866 100644
--- a/lib/crunchrun/singularity.go
+++ b/lib/crunchrun/singularity.go
@@ -24,6 +24,14 @@ func (c SingularityClient) GetHostConfig() (HostConfig, error) {
 	return c.hostConfig, nil
 }
 
+func (c SingularityClient) GetImage() (imageID string) {
+	return c.containerConfig.Image
+}
+
+func (c SingularityClient) SetImage(imageID string) {
+	c.containerConfig.Image = imageID
+}
+
 func (c SingularityClient) ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (HijackedResponse, error) {
 	fmt.Printf("placeholder for container ContainerAttach %s", container)
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list