All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 04/21] alloc_resources: Support special abandonment values
Date: Thu, 18 Apr 2019 17:31:41 +0100	[thread overview]
Message-ID: <20190418163158.11408-5-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <20190418163158.11408-1-ian.jackson@eu.citrix.com>

This gives a way for the caller's $resourcecall to signal something
interesting, back to its main loop.  This is useful for calling
broken, for example: that can't be done within $resourcecall because
$resourcecall operates within the allocation db transaction (which
ought to be rolled back...)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/Executive.pm | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 0d8502b5..b27b8d25 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -737,7 +737,8 @@ sub alloc_resources {
     #
     #  values of $ok
     #            0  rollback, wait and try again
-    #            1  commit, completed ok
+    #            1  commit, completed ok } return the
+    #           >1  rollback and abandon }  value of $ok
     #  $bookinglist should be undef or a hash for making a booking
     #
     # $resourcecall should not look at tasks.live
@@ -859,10 +860,14 @@ sub alloc_resources {
 		    # $resourcecall itself failed: bomb out (don't retry)
 		    $ok=-1;
 		}
-		return db_retry_abort() unless $ok>0;
+		return db_retry_abort() unless $ok==1;
 	    }]);
 
-	    if ($bookinglist && $ok!=-1) {
+	    if ($ok<0 || $ok>1) {
+                return 1;
+	    }
+
+	    if ($bookinglist) {
 		my %prstart;
 		foreach my $book (@{ $bookinglist->{Bookings} }) {
 		    my $pr = $book->{Reso};
@@ -890,8 +895,6 @@ sub alloc_resources {
 
             if ($ok==1) {
                 print $qserv "thought-done\n" or die $!;
-            } elsif ($ok<0) {
-                return 1;
             } else { # 0
                 logm("resource allocation: deferring");
                 print $qserv "thought-wait\n" or die $!;
@@ -935,8 +938,12 @@ END
             $ok= 0;
         }
     }
-    die unless $ok==1;
-    logm("resource allocation: successful.");
+    if ($ok==1) {
+	logm("resource allocation: successful.");
+    } else {
+	logm("resource allocation: resourcecall returned ($ok,...)");
+    }
+    return $ok;
 }
 
 sub resource_check_allocated ($$) {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [Xen-devel] [OSSTEST PATCH 04/21] alloc_resources: Support special abandonment values
Date: Thu, 18 Apr 2019 17:31:41 +0100	[thread overview]
Message-ID: <20190418163158.11408-5-ian.jackson@eu.citrix.com> (raw)
Message-ID: <20190418163141.WFP_-avrrGgqIG1dKDLgVyWa486FOz1Svn03hrEmNGA@z> (raw)
In-Reply-To: <20190418163158.11408-1-ian.jackson@eu.citrix.com>

This gives a way for the caller's $resourcecall to signal something
interesting, back to its main loop.  This is useful for calling
broken, for example: that can't be done within $resourcecall because
$resourcecall operates within the allocation db transaction (which
ought to be rolled back...)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/Executive.pm | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 0d8502b5..b27b8d25 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -737,7 +737,8 @@ sub alloc_resources {
     #
     #  values of $ok
     #            0  rollback, wait and try again
-    #            1  commit, completed ok
+    #            1  commit, completed ok } return the
+    #           >1  rollback and abandon }  value of $ok
     #  $bookinglist should be undef or a hash for making a booking
     #
     # $resourcecall should not look at tasks.live
@@ -859,10 +860,14 @@ sub alloc_resources {
 		    # $resourcecall itself failed: bomb out (don't retry)
 		    $ok=-1;
 		}
-		return db_retry_abort() unless $ok>0;
+		return db_retry_abort() unless $ok==1;
 	    }]);
 
-	    if ($bookinglist && $ok!=-1) {
+	    if ($ok<0 || $ok>1) {
+                return 1;
+	    }
+
+	    if ($bookinglist) {
 		my %prstart;
 		foreach my $book (@{ $bookinglist->{Bookings} }) {
 		    my $pr = $book->{Reso};
@@ -890,8 +895,6 @@ sub alloc_resources {
 
             if ($ok==1) {
                 print $qserv "thought-done\n" or die $!;
-            } elsif ($ok<0) {
-                return 1;
             } else { # 0
                 logm("resource allocation: deferring");
                 print $qserv "thought-wait\n" or die $!;
@@ -935,8 +938,12 @@ END
             $ok= 0;
         }
     }
-    die unless $ok==1;
-    logm("resource allocation: successful.");
+    if ($ok==1) {
+	logm("resource allocation: successful.");
+    } else {
+	logm("resource allocation: resourcecall returned ($ok,...)");
+    }
+    return $ok;
 }
 
 sub resource_check_allocated ($$) {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-04-18 16:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 16:31 [OSSTEST PATCH 00/21] Abandon jobs which are unreasonably delaying their flight Ian Jackson
2019-04-18 16:31 ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 01/21] ts-hosts-allocate-Executive: with -U, just append to the same logfile Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 02/21] selecthost: Honour new $none_ok optional parameter Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 03/21] ts-logs-capture: Do not try to capture logs of hosts not allocated Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` Ian Jackson [this message]
2019-04-18 16:31   ` [Xen-devel] [OSSTEST PATCH 04/21] alloc_resources: Support special abandonment values Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 05/21] starvation: Teach sg-report-flight about starved step state Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 06/21] starvation: Teach archaeologists about starved job state Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 07/21] starvation: Teach ms-flights-summary about job state starved Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 08/21] starvation: Teach sg-execute-flight " Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 09/21] step handling: Preserve step states set by ts-* scripts Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 10/21] TestSupport: Make "broken" print the actual job state Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 11/21] JobDB::Executive: step_*: fix log messages to talk about "steps" Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 12/21] starvation: Permit step_finish to set the state `starved' Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 13/21] TestSupport: Make "broken" set the step state too Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 14/21] tcl/JobDB-Executive: Do not squash "starved" status Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 15/21] starvation: Propagate starved job status into dependent jobs Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 16/21] ts-host-allocate-Executive: Break out $now and add a newline Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 17/21] starvation: Use "starved" for hostalloc_maxwait_max Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 18/21] starvation: Infrastructure for jobs which are delaying their flights Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 19/21] starvation: Abandon jobs which are unreasonably delaying their flight Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 20/21] hostalloc_maxwait_max: Use starvation most_optimistic Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-18 16:31 ` [OSSTEST PATCH 21/21] starvation: Better logging/debugging output Ian Jackson
2019-04-18 16:31   ` [Xen-devel] " Ian Jackson
2019-04-26 21:16 ` [OSSTEST PATCH 00/21] Abandon jobs which are unreasonably delaying their flight Julien Grall
2019-04-26 21:16   ` [Xen-devel] " Julien Grall
2019-04-29 14:46   ` Ian Jackson
2019-04-29 14:46     ` [Xen-devel] " Ian Jackson
2019-04-30 14:26     ` Julien Grall
2019-04-30 14:26       ` [Xen-devel] " Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190418163158.11408-5-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.