X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/08c80b2ba6a8fc090d2e998dfcf2f280c8508019..38a0f5e77f2190487d03d6538337d3b7055fd1e8:/lib/crunchrun/crunchrun.go diff --git a/lib/crunchrun/crunchrun.go b/lib/crunchrun/crunchrun.go index 6e7e6feba5..7d6fb4ed47 100644 --- a/lib/crunchrun/crunchrun.go +++ b/lib/crunchrun/crunchrun.go @@ -178,6 +178,8 @@ type ContainerRunner struct { arvMountLog *ThrottledLogger containerWatchdogInterval time.Duration + + gateway Gateway } // setupSignals sets up signal handling to gracefully terminate the underlying @@ -1478,7 +1480,7 @@ func (runner *ContainerRunner) UpdateContainerRunning() error { return ErrCancelled } return runner.DispatcherArvClient.Update("containers", runner.Container.UUID, - arvadosclient.Dict{"container": arvadosclient.Dict{"state": "Running"}}, nil) + arvadosclient.Dict{"container": arvadosclient.Dict{"state": "Running", "gateway_address": runner.gateway.Address}}, nil) } // ContainerToken returns the api_token the container (and any @@ -1877,6 +1879,20 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s return 1 } + cr.gateway = Gateway{ + Address: os.Getenv("GatewayAddress"), + AuthSecret: os.Getenv("GatewayAuthSecret"), + ContainerUUID: containerID, + DockerContainerID: &cr.ContainerID, + Log: cr.CrunchLog, + } + os.Unsetenv("GatewayAuthSecret") + err = cr.gateway.Start() + if err != nil { + log.Printf("error starting gateway server: %s", err) + return 1 + } + parentTemp, tmperr := cr.MkTempDir("", "crunch-run."+containerID+".") if tmperr != nil { log.Printf("%s: %v", containerID, tmperr)