[ARVADOS] updated: 1.1.4-522-g0765fb8b1

Git user git at public.curoverse.com
Wed Jun 27 16:45:48 EDT 2018


Summary of changes:
 sdk/go/arvados/container.go                  |  1 -
 sdk/go/dispatch/dispatch.go                  |  7 -------
 services/api/app/models/container.rb         |  4 +---
 services/api/app/models/container_request.rb |  4 +---
 services/crunch-run/crunchrun.go             |  9 +++++++++
 services/crunch-run/crunchrun_test.go        | 22 +++++++++++++++++++++-
 6 files changed, 32 insertions(+), 15 deletions(-)

       via  0765fb8b19dd7b76ec5d2d05edda3f4fd4347194 (commit)
       via  286f7fb2dbdcd860275a24f3480e938b5bd414ec (commit)
      from  57fd9fa6bf0ee3062d7d38aceb7e97543791d241 (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 0765fb8b19dd7b76ec5d2d05edda3f4fd4347194
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Wed Jun 27 17:43:58 2018 -0300

    13219: Moves time out code from dispatch to crunch-run
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/sdk/go/arvados/container.go b/sdk/go/arvados/container.go
index 1bdf08902..210ed9981 100644
--- a/sdk/go/arvados/container.go
+++ b/sdk/go/arvados/container.go
@@ -20,7 +20,6 @@ type Container struct {
 	OutputPath           string               `json:"output_path"`
 	Priority             int                  `json:"priority"`
 	RuntimeConstraints   RuntimeConstraints   `json:"runtime_constraints"`
-	StartedAt            time.Time            `json:"started_at"`
 	State                ContainerState       `json:"state"`
 	SchedulingParameters SchedulingParameters `json:"scheduling_parameters"`
 }
diff --git a/sdk/go/dispatch/dispatch.go b/sdk/go/dispatch/dispatch.go
index ca2dbc48d..3289c67b0 100644
--- a/sdk/go/dispatch/dispatch.go
+++ b/sdk/go/dispatch/dispatch.go
@@ -195,13 +195,6 @@ func (d *Dispatcher) checkListForUpdates(containers []arvados.Container, todo ma
 			case Queued:
 				tracker.close()
 			case Locked, Running:
-				if c.SchedulingParameters.MaxRunTime > 0 {
-					maxRunTime := time.Duration(c.SchedulingParameters.MaxRunTime) * time.Second
-					if time.Since(c.StartedAt) >= maxRunTime {
-						// Time's up, schedule container for cancellation
-						c.Priority = 0
-					}
-				}
 				tracker.update(c)
 			case Cancelled, Complete:
 				tracker.close()
diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index 2f9ccf524..adce853a5 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -1074,10 +1074,14 @@ func (runner *ContainerRunner) StartContainer() error {
 // WaitFinish waits for the container to terminate, capture the exit code, and
 // close the stdout/stderr logging.
 func (runner *ContainerRunner) WaitFinish() error {
+	var runTimeExceeded <-chan time.Time
 	runner.CrunchLog.Print("Waiting for container to finish")
 
 	waitOk, waitErr := runner.Docker.ContainerWait(context.TODO(), runner.ContainerID, dockercontainer.WaitConditionNotRunning)
 	arvMountExit := runner.ArvMountExit
+	if timeout := runner.Container.SchedulingParameters.MaxRunTime; timeout > 0 {
+		runTimeExceeded = time.After(time.Duration(timeout) * time.Second)
+	}
 	for {
 		select {
 		case waitBody := <-waitOk:
@@ -1098,6 +1102,11 @@ func (runner *ContainerRunner) WaitFinish() error {
 			// arvMountExit will always be ready now that
 			// it's closed, but that doesn't interest us.
 			arvMountExit = nil
+
+		case <-runTimeExceeded:
+			runner.CrunchLog.Printf("maximum run time exceeded. Stopping container.")
+			runner.stop(nil)
+			runTimeExceeded = nil
 		}
 	}
 }
diff --git a/services/crunch-run/crunchrun_test.go b/services/crunch-run/crunchrun_test.go
index c76682f1c..8ad487d77 100644
--- a/services/crunch-run/crunchrun_test.go
+++ b/services/crunch-run/crunchrun_test.go
@@ -793,7 +793,7 @@ func (s *TestSuite) TestFullRunHello(c *C) {
     "mounts": {"/tmp": {"kind": "tmp"} },
     "output_path": "/tmp",
     "priority": 1,
-    "runtime_constraints": {}
+	"runtime_constraints": {}
 }`, nil, 0, func(t *TestDockerClient) {
 		t.logWriter.Write(dockerLog(1, "hello world\n"))
 		t.logWriter.Close()
@@ -805,6 +805,26 @@ func (s *TestSuite) TestFullRunHello(c *C) {
 
 }
 
+func (s *TestSuite) TestRunTimeExceeded(c *C) {
+	api, _, _ := s.fullRunHelper(c, `{
+    "command": ["sleep", "3"],
+    "container_image": "d4ab34d3d4f8a72f5c4973051ae69fab+122",
+    "cwd": ".",
+    "environment": {},
+    "mounts": {"/tmp": {"kind": "tmp"} },
+    "output_path": "/tmp",
+    "priority": 1,
+	"runtime_constraints": {},
+	"scheduling_parameters":{"max_run_time": 1}
+}`, nil, 0, func(t *TestDockerClient) {
+		time.Sleep(3 * time.Second)
+		t.logWriter.Close()
+	})
+
+	c.Check(api.CalledWith("container.state", "Cancelled"), NotNil)
+	c.Check(api.Logs["crunch-run"].String(), Matches, "(?ms).*maximum run time exceeded.*")
+}
+
 func (s *TestSuite) TestCrunchstat(c *C) {
 	api, _, _ := s.fullRunHelper(c, `{
 		"command": ["sleep", "1"],

commit 286f7fb2dbdcd860275a24f3480e938b5bd414ec
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Wed Jun 27 15:30:05 2018 -0300

    13219: Removes unnecessary default max_run_time scheduling parameter
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 06bd4a590..7ec9845bc 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -364,9 +364,7 @@ class Container < ArvadosModel
     self.mounts ||= {}
     self.cwd ||= "."
     self.priority ||= 0
-    self.scheduling_parameters ||= {
-      max_run_time: 0,
-    }
+    self.scheduling_parameters ||= {}
   end
 
   def permission_to_create
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index d80bd0c67..dd3ff767d 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -173,9 +173,7 @@ class ContainerRequest < ArvadosModel
     self.mounts ||= {}
     self.cwd ||= "."
     self.container_count_max ||= Rails.configuration.container_count_max
-    self.scheduling_parameters ||= {
-      max_run_time: 0,
-    }
+    self.scheduling_parameters ||= {}
     self.output_ttl ||= 0
     self.priority ||= 0
   end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list