[ARVADOS] updated: 3f5c2b95de8483e277a472846ad7e5b2ccb1f79a
Git user
git at public.curoverse.com
Mon Apr 10 09:31:35 EDT 2017
Summary of changes:
services/crunch-run/crunchrun.go | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
via 3f5c2b95de8483e277a472846ad7e5b2ccb1f79a (commit)
from 3ceb42c882b32fb9e4ef79679576254f98cdfb3d (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 3f5c2b95de8483e277a472846ad7e5b2ccb1f79a
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Apr 7 17:06:01 2017 -0400
8465: Set proper container flags to provide data on stdin.
diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index c8f77f4..6406c17 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -380,7 +380,7 @@ func (runner *ContainerRunner) SetupMounts() (err error) {
}
switch {
- case mnt.Kind == "collection":
+ case mnt.Kind == "collection" && bind != "stdin":
var src string
if mnt.UUID != "" && mnt.PortableDataHash != "" {
return fmt.Errorf("Cannot specify both 'uuid' and 'portable_data_hash' for a collection mount")
@@ -692,8 +692,6 @@ func (runner *ContainerRunner) AttachStreams() (err error) {
} else if err != nil {
return fmt.Errorf("While getting stdin collection path %v: %v", stdinMnt.Path, err)
}
-
- defer stdinRdr.Close()
} else if stdinMnt.Kind == "json" {
stdinJson, err = json.Marshal(stdinMnt.Content)
if err != nil {
@@ -745,7 +743,8 @@ func (runner *ContainerRunner) AttachStreams() (err error) {
runner.CrunchLog.Print("While writing stdin collection to docker container %q", err)
runner.stop()
}
- response.Conn.Close()
+ stdinRdr.Close()
+ response.CloseWrite()
}()
} else if len(stdinJson) != 0 {
go func() {
@@ -754,7 +753,7 @@ func (runner *ContainerRunner) AttachStreams() (err error) {
runner.CrunchLog.Print("While writing stdin json to docker container %q", err)
runner.stop()
}
- response.Conn.Close()
+ response.CloseWrite()
}()
}
@@ -803,6 +802,13 @@ func (runner *ContainerRunner) CreateContainer() error {
}
}
+ _, stdinUsed := runner.Container.Mounts["stdin"]
+ runner.ContainerConfig.OpenStdin = stdinUsed
+ runner.ContainerConfig.StdinOnce = stdinUsed
+ runner.ContainerConfig.AttachStdin = stdinUsed
+ runner.ContainerConfig.AttachStdout = true
+ runner.ContainerConfig.AttachStderr = true
+
createdBody, err := runner.Docker.ContainerCreate(context.TODO(), &runner.ContainerConfig, &runner.HostConfig, nil, runner.Container.UUID)
if err != nil {
return fmt.Errorf("While creating container: %v", err)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list