[ARVADOS] updated: 1.3.0-363-g36e1f63fd

Git user git at public.curoverse.com
Tue Feb 19 15:49:27 EST 2019


Summary of changes:
 build/run-tests.sh                |  1 -
 lib/dispatchcloud/dispatcher.go   | 14 ++++++-------
 services/crunch-run/background.go | 42 +++++++++------------------------------
 3 files changed, 16 insertions(+), 41 deletions(-)

       via  36e1f63fde4005f38a8d9825abc8244057d9bb58 (commit)
       via  970af93afee8838a6e6be52e897c639ba13c7d3f (commit)
       via  79693e508b0c2a61bc006994c6245697e32c2586 (commit)
      from  e1e0f678978cd2e6d81cba1f61de06effa961afa (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 36e1f63fde4005f38a8d9825abc8244057d9bb58
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Tue Feb 19 11:35:22 2019 -0500

    14807: Send detached crunch-run logs to journal via systemd-cat.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/crunch-run/background.go b/services/crunch-run/background.go
index 334b3ab67..b3c530e69 100644
--- a/services/crunch-run/background.go
+++ b/services/crunch-run/background.go
@@ -8,7 +8,6 @@ import (
 	"encoding/json"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"os"
 	"os/exec"
 	"path/filepath"
@@ -25,16 +24,17 @@ var (
 
 // procinfo is saved in each process's lockfile.
 type procinfo struct {
-	UUID   string
-	PID    int
-	Stdout string
-	Stderr string
+	UUID string
+	PID  int
 }
 
 // Detach acquires a lock for the given uuid, and starts the current
 // program as a child process (with -no-detach prepended to the given
 // arguments so the child knows not to detach again). The lock is
 // passed along to the child process.
+//
+// Stdout and stderr in the child process are sent to the systemd
+// journal using the systemd-cat program.
 func Detach(uuid string, args []string, stdout, stderr io.Writer) int {
 	return exitcode(stderr, detach(uuid, args, stdout, stderr))
 }
@@ -67,21 +67,7 @@ func detach(uuid string, args []string, stdout, stderr io.Writer) error {
 	defer lockfile.Close()
 	lockfile.Truncate(0)
 
-	outfile, err := ioutil.TempFile("", "crunch-run-"+uuid+"-stdout-")
-	if err != nil {
-		return err
-	}
-	defer outfile.Close()
-	errfile, err := ioutil.TempFile("", "crunch-run-"+uuid+"-stderr-")
-	if err != nil {
-		os.Remove(outfile.Name())
-		return err
-	}
-	defer errfile.Close()
-
-	cmd := exec.Command(args[0], append([]string{"-no-detach"}, args[1:]...)...)
-	cmd.Stdout = outfile
-	cmd.Stderr = errfile
+	cmd := exec.Command("systemd-cat", append([]string{"--identifier=crunch-run", args[0], "-no-detach"}, args[1:]...)...)
 	// Child inherits lockfile.
 	cmd.ExtraFiles = []*os.File{lockfile}
 	// Ensure child isn't interrupted even if we receive signals
@@ -90,24 +76,14 @@ func detach(uuid string, args []string, stdout, stderr io.Writer) error {
 	cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
 	err = cmd.Start()
 	if err != nil {
-		os.Remove(outfile.Name())
-		os.Remove(errfile.Name())
 		return fmt.Errorf("exec %s: %s", cmd.Path, err)
 	}
 
 	w := io.MultiWriter(stdout, lockfile)
-	err = json.NewEncoder(w).Encode(procinfo{
-		UUID:   uuid,
-		PID:    cmd.Process.Pid,
-		Stdout: outfile.Name(),
-		Stderr: errfile.Name(),
+	return json.NewEncoder(w).Encode(procinfo{
+		UUID: uuid,
+		PID:  cmd.Process.Pid,
 	})
-	if err != nil {
-		os.Remove(outfile.Name())
-		os.Remove(errfile.Name())
-		return err
-	}
-	return nil
 }
 
 // KillProcess finds the crunch-run process corresponding to the given

commit 970af93afee8838a6e6be52e897c639ba13c7d3f
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Feb 18 14:48:24 2019 -0500

    14807: Remove errant rm.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/build/run-tests.sh b/build/run-tests.sh
index 9919c3e17..caaca1f31 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -537,7 +537,6 @@ export GOPATH
 (
     set -e
     mkdir -p "$GOPATH/src/git.curoverse.com"
-    rmdir -v --parents --ignore-fail-on-non-empty "${temp}/GOPATH"
     if [[ ! -h "$GOPATH/src/git.curoverse.com/arvados.git" ]]; then
         for d in \
             "$GOPATH/src/git.curoverse.com/arvados.git/tmp/GOPATH" \

commit 79693e508b0c2a61bc006994c6245697e32c2586
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Feb 18 14:32:31 2019 -0500

    14807: Update API endpoints: instance_id is always a query param.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/dispatchcloud/dispatcher.go b/lib/dispatchcloud/dispatcher.go
index 5be9283a8..adf1028b3 100644
--- a/lib/dispatchcloud/dispatcher.go
+++ b/lib/dispatchcloud/dispatcher.go
@@ -144,9 +144,9 @@ func (disp *dispatcher) initialize() {
 		mux := httprouter.New()
 		mux.HandlerFunc("GET", "/arvados/v1/dispatch/containers", disp.apiContainers)
 		mux.HandlerFunc("GET", "/arvados/v1/dispatch/instances", disp.apiInstances)
-		mux.HandlerFunc("POST", "/arvados/v1/dispatch/instances/:instance_id/hold", disp.apiInstanceHold)
-		mux.HandlerFunc("POST", "/arvados/v1/dispatch/instances/:instance_id/drain", disp.apiInstanceDrain)
-		mux.HandlerFunc("POST", "/arvados/v1/dispatch/instances/:instance_id/run", disp.apiInstanceRun)
+		mux.HandlerFunc("POST", "/arvados/v1/dispatch/instances/hold", disp.apiInstanceHold)
+		mux.HandlerFunc("POST", "/arvados/v1/dispatch/instances/drain", disp.apiInstanceDrain)
+		mux.HandlerFunc("POST", "/arvados/v1/dispatch/instances/run", disp.apiInstanceRun)
 		metricsH := promhttp.HandlerFor(disp.reg, promhttp.HandlerOpts{
 			ErrorLog: disp.logger,
 		})
@@ -213,10 +213,10 @@ func (disp *dispatcher) apiInstanceRun(w http.ResponseWriter, r *http.Request) {
 }
 
 func (disp *dispatcher) apiInstanceIdleBehavior(w http.ResponseWriter, r *http.Request, want worker.IdleBehavior) {
-	params, _ := r.Context().Value(httprouter.ParamsKey).(httprouter.Params)
-	id := cloud.InstanceID(params.ByName("instance_id"))
-	if qp := r.FormValue("instance_id"); qp != "" {
-		id = cloud.InstanceID(qp)
+	id := cloud.InstanceID(r.FormValue("instance_id"))
+	if id == "" {
+		httpserver.Error(w, "instance_id parameter not provided", http.StatusBadRequest)
+		return
 	}
 	err := disp.pool.SetIdleBehavior(id, want)
 	if err != nil {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list