You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bu...@apache.org on 2015/03/20 19:25:18 UTC
svn commit: r1668112 -
/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccReservationSubmit.java
Author: burn
Date: Fri Mar 20 18:25:17 2015
New Revision: 1668112
URL: http://svn.apache.org/r1668112
Log:
UIMA-4293 Reject reservations unless for a reserve-policy class
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccReservationSubmit.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccReservationSubmit.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccReservationSubmit.java?rev=1668112&r1=1668111&r2=1668112&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccReservationSubmit.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccReservationSubmit.java Fri Mar 20 18:25:17 2015
@@ -19,8 +19,10 @@
package org.apache.uima.ducc.cli;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Properties;
+import org.apache.uima.ducc.common.utils.DuccSchedulerClasses;
import org.apache.uima.ducc.transport.event.SubmitReservationDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitReservationReplyDuccEvent;
import org.apache.uima.ducc.transport.event.cli.ReservationReplyProperties;
@@ -85,12 +87,21 @@ public class DuccReservationSubmit
* Execute collects the parameters for the reservation and sends them to the DUCC Orchestrator
* to schedule the reservation. This method blocks until either the reservation is
* granted, or it fails. Failure is always do to lack of resources, in some form or another.
- * Reservations are granted all-or-nothing: you get everything you ask for, or you get nothing.
+ * Reservations must be from one of the 'reserve' classes i.e for a whole machine.
*
* @return True if the DUCC grants the reservation.
+ * @throws Exception
*/
- public boolean execute()
+ public boolean execute() throws Exception
{
+ String pname = UiOption.SchedulingClass.pname();
+ String scheduling_class = requestProperties.getProperty(pname);
+ if (scheduling_class != null) {
+ String[] reserveClasses = DuccSchedulerClasses.getInstance().getReserveClasses();
+ if (!Arrays.asList(reserveClasses).contains(scheduling_class)) {
+ throw new IllegalArgumentException("Invalid value for scheduling_class - must be one of the reserve classes");
+ }
+ }
SubmitReservationDuccEvent ev = new SubmitReservationDuccEvent(requestProperties, CliVersion.getVersion());
SubmitReservationReplyDuccEvent reply = null;