projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
17756: Add arvados-dispatch-lsf install doc page.
[arvados.git]
/
lib
/
dispatchcloud
/
worker
/
runner.go
diff --git
a/lib/dispatchcloud/worker/runner.go
b/lib/dispatchcloud/worker/runner.go
index e819a6036b341d5d2bbe28a242292296b5b36cd2..63561874c9c5e570187048922addbbc4e4ece502 100644
(file)
--- a/
lib/dispatchcloud/worker/runner.go
+++ b/
lib/dispatchcloud/worker/runner.go
@@
-8,6
+8,8
@@
import (
"bytes"
"encoding/json"
"fmt"
"bytes"
"encoding/json"
"fmt"
+ "net"
+ "strings"
"syscall"
"time"
"syscall"
"time"
@@
-20,6
+22,8
@@
type remoteRunner struct {
uuid string
executor Executor
envJSON json.RawMessage
uuid string
executor Executor
envJSON json.RawMessage
+ runnerCmd string
+ runnerArgs []string
remoteUser string
timeoutTERM time.Duration
timeoutSignal time.Duration
remoteUser string
timeoutTERM time.Duration
timeoutSignal time.Duration
@@
-47,6
+51,8
@@
func newRemoteRunner(uuid string, wkr *worker) *remoteRunner {
"ARVADOS_API_HOST": wkr.wp.arvClient.APIHost,
"ARVADOS_API_TOKEN": wkr.wp.arvClient.AuthToken,
"InstanceType": instJSON.String(),
"ARVADOS_API_HOST": wkr.wp.arvClient.APIHost,
"ARVADOS_API_TOKEN": wkr.wp.arvClient.AuthToken,
"InstanceType": instJSON.String(),
+ "GatewayAddress": net.JoinHostPort(wkr.instance.Address(), "0"),
+ "GatewayAuthSecret": wkr.wp.gatewayAuthSecret(uuid),
}
if wkr.wp.arvClient.Insecure {
env["ARVADOS_API_HOST_INSECURE"] = "1"
}
if wkr.wp.arvClient.Insecure {
env["ARVADOS_API_HOST_INSECURE"] = "1"
@@
-59,6
+65,8
@@
func newRemoteRunner(uuid string, wkr *worker) *remoteRunner {
uuid: uuid,
executor: wkr.executor,
envJSON: envJSON,
uuid: uuid,
executor: wkr.executor,
envJSON: envJSON,
+ runnerCmd: wkr.wp.runnerCmd,
+ runnerArgs: wkr.wp.runnerArgs,
remoteUser: wkr.instance.RemoteUser(),
timeoutTERM: wkr.wp.timeoutTERM,
timeoutSignal: wkr.wp.timeoutSignal,
remoteUser: wkr.instance.RemoteUser(),
timeoutTERM: wkr.wp.timeoutTERM,
timeoutSignal: wkr.wp.timeoutSignal,
@@
-76,7
+84,11
@@
func newRemoteRunner(uuid string, wkr *worker) *remoteRunner {
// assume the remote process _might_ have started, at least until it
// probes the worker and finds otherwise.
func (rr *remoteRunner) Start() {
// assume the remote process _might_ have started, at least until it
// probes the worker and finds otherwise.
func (rr *remoteRunner) Start() {
- cmd := "crunch-run --detach --stdin-env '" + rr.uuid + "'"
+ cmd := rr.runnerCmd + " --detach --stdin-env"
+ for _, arg := range rr.runnerArgs {
+ cmd += " '" + strings.Replace(arg, "'", "'\\''", -1) + "'"
+ }
+ cmd += " '" + rr.uuid + "'"
if rr.remoteUser != "root" {
cmd = "sudo " + cmd
}
if rr.remoteUser != "root" {
cmd = "sudo " + cmd
}
@@
-136,7
+148,7
@@
func (rr *remoteRunner) Kill(reason string) {
func (rr *remoteRunner) kill(sig syscall.Signal) {
logger := rr.logger.WithField("Signal", int(sig))
logger.Info("sending signal")
func (rr *remoteRunner) kill(sig syscall.Signal) {
logger := rr.logger.WithField("Signal", int(sig))
logger.Info("sending signal")
- cmd := fmt.Sprintf(
"crunch-run
--kill %d %s", sig, rr.uuid)
+ cmd := fmt.Sprintf(
rr.runnerCmd+"
--kill %d %s", sig, rr.uuid)
if rr.remoteUser != "root" {
cmd = "sudo " + cmd
}
if rr.remoteUser != "root" {
cmd = "sudo " + cmd
}