Permalink
Browse files

-Renamed package org.globus.workspace.spotinstances to org.globus.wor…

…kspace.async

-Refactored spotinstances.conf
-Few refactoring
  • Loading branch information...
1 parent c5cffa3 commit a8fbf8298bc53e53203602d83b2ff214255a3d07 @pauloricardomg pauloricardomg committed Aug 3, 2010
Showing with 110 additions and 93 deletions.
  1. +6 −6 service/service/java/source/etc/workspace-service/other/main.xml
  2. +27 −17 service/service/java/source/etc/workspace-service/spotinstances.conf
  3. +5 −5 service/service/java/source/src/org/globus/workspace/{spotinstances → async}/AsyncRequest.java
  4. +14 −0 service/service/java/source/src/org/globus/workspace/async/AsyncRequestException.java
  5. +4 −17 ...urce/src/org/globus/workspace/{spotinstances/SIRequestUtils.java → async/AsyncRequestFilter.java}
  6. +15 −5 service/service/java/source/src/org/globus/workspace/{spotinstances → async}/AsyncRequestHome.java
  7. +3 −3 ...ice/service/java/source/src/org/globus/workspace/{spotinstances → async}/AsyncRequestManager.java
  8. +12 −11 ...service/java/source/src/org/globus/workspace/{spotinstances → async}/AsyncRequestManagerImpl.java
  9. +1 −1 service/service/java/source/src/org/globus/workspace/{spotinstances → async}/AsyncRequestStatus.java
  10. +3 −1 ...va/source/src/org/globus/workspace/{spotinstances → async/pricingmodel}/AbstractPricingModel.java
  11. +6 −3 ...rce/src/org/globus/workspace/{spotinstances → async/pricingmodel}/MaximizeProfitPricingModel.java
  12. +3 −1 ...rc/org/globus/workspace/{spotinstances → async/pricingmodel}/MaximizeUtilizationPricingModel.java
  13. +3 −1 ...rvice/java/source/src/org/globus/workspace/{spotinstances → async/pricingmodel}/PricingModel.java
  14. +1 −1 ...a/source/src/org/globus/workspace/{spotinstances → async/pricingmodel}/PricingModelConstants.java
  15. +1 −1 service/service/java/source/src/org/globus/workspace/creation/CreationManager.java
  16. +2 −2 service/service/java/source/src/org/globus/workspace/creation/defaults/CreationManagerImpl.java
  17. +2 −2 service/service/java/source/src/org/globus/workspace/manager/DelegatingManager.java
  18. +2 −2 service/service/java/source/src/org/globus/workspace/persistence/DataConvert.java
  19. +0 −14 service/service/java/source/src/org/globus/workspace/spotinstances/SIRequestException.java
@@ -545,30 +545,30 @@
</bean>
<!-- ===================================================================
- org.globus.workspace.spotinstances.* interfaces
+ org.globus.workspace.async.* interfaces
=================================================================== -->
- <bean id="nimbus-rm.spotinstances.pricingmodel"
+ <bean id="nimbus-rm.si.pricingmodel"
class="$SI{si.pricingmodel}" />
<bean id="nimbus-rm.async.manager"
- class="org.globus.workspace.spotinstances.AsyncRequestManagerImpl">
+ class="org.globus.workspace.async.AsyncRequestManagerImpl">
<constructor-arg ref="nimbus-rm.persistence.PersistenceAdapter" />
<constructor-arg ref="nimbus-rm.loglevels" />
<constructor-arg ref="nimbus-rm.home.instance"/>
<constructor-arg ref="nimbus-rm.home.group"/>
<constructor-arg value="$SI{si.basic.minprice}" />
- <constructor-arg ref="nimbus-rm.spotinstances.pricingmodel" />
+ <constructor-arg ref="nimbus-rm.si.pricingmodel" />
<!-- set after object creation time to avoid circular dep -->
<property name="creationManager" ref="nimbus-rm.creation" />
<!-- Property values coming via spotinstances.conf -->
<property name="minReservedMem"
- value="$SI{si.policies.minreservedmem}" />
+ value="$SI{async.policies.minreservedmem}" />
<property name="maxUtilization"
- value="$SI{si.policies.maxutilization}" />
+ value="$SI{async.policies.maxutilization}" />
<property name="instanceMem"
value="$SI{si.basic.mem}" />
@@ -1,8 +1,10 @@
-################################################################################
+######################################################
#
-# This file is used for configuring Spot Instances within this site
+# This file is used for configuring asynchronous
+# requests (Spot Instances and
+# backfill requests) for this site
#
-################################################################################
+######################################################
###########################
# GENERAL CONFIGURATION:
@@ -13,6 +15,11 @@
si.enabled=true
+# Indicates whether the backfill feature
+# is enabled (true) or disabled (false) for this site
+
+backfill.enabled=true
+
# A pricing model is invoked every time the Spot Instances
# environment changes. This can happen in many situations:
# when a request arrives, is canceled or terminated, when
@@ -36,19 +43,19 @@ si.enabled=true
# Currently there are two default implementations of that
# interface, explained as follows:
#
-# ** org.globus.workspace.spotinstances.MaximizeUtilizationPricingModel **
+# ** org.globus.workspace.async.pricingmodel.MaximizeUtilizationPricingModel **
#
# This pricing model aims to satisfy the maximum number of requests, giving
# priority to higher bid requests when there aren't available VMs to fulfill
# all requests. Suitable for scientific clouds.
#
-# ** org.globus.workspace.spotinstances.MaximizeProfitPricingModel **
+# ** org.globus.workspace.async.pricingmodel.MaximizeProfitPricingModel **
#
# This pricing model aims to maximize the revenue of the cloud provider,
# without necessarily increasing cloud utilization. Suitable for commercial
# clouds.
-si.pricingmodel=org.globus.workspace.spotinstances.MaximizeUtilizationPricingModel
+si.pricingmodel=org.globus.workspace.async.pricingmodel.MaximizeUtilizationPricingModel
####################################
# BASIC SPOT INSTANCE CONFIGURATION:
@@ -71,26 +78,29 @@ si.basic.minprice=0.1
# The policies below define how the total resource pool memory is #
# divided between ordinary Workspace Service requests #
-# (1st class requests) and Spot Instance requests (SI requests). #
+# (1st class requests) and Asynchronous requests (SI or backfill #
+# requests). #
# #
# It's important to note that these policies are preventive, in the #
# sense that free space is reserved for future 1st class requests, #
# but if the reserved space is still not sufficient to satisfy a #
-# 1st class request, SI requests will be pre-empted on-the-fly in #
-# order to free the needed amount of space (emergency pre-emption) #
+# 1st class request, SI or backfill requests will be pre-empted #
+# on-the-fly in order to free the needed amount of space (emergency #
+# pre-emption) #
# This policy defines the minimum amount of free memory (in MegaBytes)
# that should be reserved exclusively for 1st class requests, and thus
-# will not be allocated for SI requests.
+# will not be allocated for SI or backfill requests.
-si.policies.minreservedmem=256
+async.policies.minreservedmem=256
# This policy defines the maximum utilization (in %) for
-# 1st class requests. When the utilization raises above that
-# value, Spot Instance requests are pre-empted (preventive pre-emption)
-# in order to decrease the utilization of 1st class requests.
+# 1st class requests. When the utilization raises above this
+# value, Spot Instance or backfill requests are pre-empted
+# (preventive pre-emption) in order to decrease the
+# utilization of 1st class requests.
#
-# The Spot Instances module will reserve an amount of free
+# The Workspace Service will reserve an amount of free
# memory for 1st class requests in order to ensure that
# the utilization of 1st class requests is equal or below
# that value, unless there is no more available memory
@@ -101,8 +111,8 @@ si.policies.minreservedmem=256
#
# * maxUtilization = usedMem / (usedMem + reservedMem)
#
-# that, if reorganized becomes:
+# reorganized, becomes:
#
# * reservedMem = (1 - maxUtilization)*usedMem/maxUtilization
-si.policies.maxutilization=0.7
+async.policies.maxutilization=0.7
@@ -1,4 +1,4 @@
-package org.globus.workspace.spotinstances;
+package org.globus.workspace.async;
import java.util.Calendar;
import java.util.Collection;
@@ -226,9 +226,9 @@ public boolean finishVM(int vmid) {
return toBePreempted.remove(vmid);
}
- public VirtualMachine[] getUnallocatedVMs(int quantity) throws SIRequestException{
+ public VirtualMachine[] getUnallocatedVMs(int quantity) throws AsyncRequestException{
if(this.getUnallocatedInstances() < quantity){
- throw new SIRequestException("Requested " + quantity + " unallocated VMs, but there are only " + this.getUnallocatedInstances() + ".");
+ throw new AsyncRequestException("Requested " + quantity + " unallocated VMs, but there are only " + this.getUnallocatedInstances() + ".");
}
VirtualMachine[] result = new VirtualMachine[quantity];
@@ -244,9 +244,9 @@ public boolean finishVM(int vmid) {
return result;
}
- public int[] getAllocatedVMs(int quantity) throws SIRequestException{
+ public int[] getAllocatedVMs(int quantity) throws AsyncRequestException{
if(this.getAllocatedInstances() < quantity){
- throw new SIRequestException("Requested " + quantity + " allocated VMs, but there are only " + getAllocatedInstances() + ".");
+ throw new AsyncRequestException("Requested " + quantity + " allocated VMs, but there are only " + getAllocatedInstances() + ".");
}
int[] result = new int[quantity];
@@ -0,0 +1,14 @@
+package org.globus.workspace.async;
+
+public class AsyncRequestException extends Exception {
+
+ public AsyncRequestException(String message) {
+ super(message);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
@@ -1,10 +1,10 @@
-package org.globus.workspace.spotinstances;
+package org.globus.workspace.async;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-public class SIRequestUtils {
+public class AsyncRequestFilter {
public static List<AsyncRequest> getRequestsEqualPrice(
Double price, Collection<AsyncRequest> allRequests) {
@@ -54,7 +54,7 @@
List<AsyncRequest> activeRequestsEqualPrice = new ArrayList<AsyncRequest>();
for (AsyncRequest siRequest : allRequests) {
- if(siRequest.getStatus().isAlive() && siRequest.getMaxBid().equals(price)){
+ if(siRequest.isSpotRequest() && siRequest.getStatus().isAlive() && siRequest.getMaxBid().equals(price)){
activeRequestsEqualPrice.add(siRequest);
}
}
@@ -67,7 +67,7 @@
List<AsyncRequest> aliveRequestsAbovePrice = new ArrayList<AsyncRequest>();
for (AsyncRequest siRequest : allRequests) {
- if(siRequest.getStatus().isAlive() && siRequest.getMaxBid() > currentPrice){
+ if(siRequest.isSpotRequest() && siRequest.getStatus().isAlive() && siRequest.getMaxBid() > currentPrice){
aliveRequestsAbovePrice.add(siRequest);
}
}
@@ -89,19 +89,6 @@
return aliveRequests;
}
- public static Collection<AsyncRequest> filterActiveRequests(
- Collection<AsyncRequest> allRequests) {
- List<AsyncRequest> activeRequests = new ArrayList<AsyncRequest>();
-
- for (AsyncRequest siRequest : allRequests) {
- if(siRequest.getStatus().isActive()){
- activeRequests.add(siRequest);
- }
- }
-
- return activeRequests;
- }
-
public static List<AsyncRequest> filterAliveBackfillRequests(
Collection<AsyncRequest> allRequests) {
List<AsyncRequest> activeRequests = new ArrayList<AsyncRequest>();
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-package org.globus.workspace.spotinstances;
+package org.globus.workspace.async;
import java.util.Calendar;
import java.util.List;
@@ -27,12 +27,12 @@
/**
* Frontend interface that provides
* RETRIEVE and CANCEL operations to
- * Spot Instance Requests
+ * Asynchronous requests
*/
public interface AsyncRequestHome {
/**
- * Cancels a Spot Instance request
+ * Cancels an asynchronous request
* @param reqID the id of the request to be canceled
* @return the canceled request
* @throws DoesNotExistException in case the id argument does not map
@@ -41,7 +41,7 @@
public AsyncRequest cancelRequest(String reqID) throws DoesNotExistException;
/**
- * Retrieves a Spot Instance request and its related information
+ * Retrieves an asynchronous request and its related information
* @param id the id of the request to be retrieved
* @return the wanted request
* @throws DoesNotExistException in case the id argument does not map
@@ -50,7 +50,7 @@
public AsyncRequest getRequest(String id) throws DoesNotExistException;
/**
- * Retrieves all Spot Instance requests from a caller
+ * Retrieves all asynchronous requests from a caller
* @param caller the owner of the Spot Instances' requests
* @return an array of spot instance requests from this caller
*/
@@ -62,6 +62,16 @@
*/
public Double getSpotPrice();
+ /**
+ * Retrieves the spot price history
+ * @param startDate the date the history should start. <b>null</n>
+ * indicates there is no start date.
+ * @param endDate the date the history should end. <b>null</n>
+ * indicates there is no end date.
+ * @return a list of spot price entries from the start date until the end date
+ * @throws WorkspaceDatabaseException in case there is an error
+ * in the databsae, while obtaining the history data
+ */
public List<SpotPriceEntry> getSpotPriceHistory(Calendar startDate, Calendar endDate)
throws WorkspaceDatabaseException;
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-package org.globus.workspace.spotinstances;
+package org.globus.workspace.async;
import org.globus.workspace.StateChangeInterested;
import org.globus.workspace.scheduler.defaults.PreemptableSpaceManager;
@@ -25,8 +25,8 @@
public interface AsyncRequestManager extends AsyncRequestHome, PreemptableSpaceManager, StateChangeInterested {
/**
- * Adds a Spot Instances request
- * to this module
+ * Adds an asynchronous request
+ * to this manager
* @param request the request to be added
*/
public void addRequest(AsyncRequest request);
Oops, something went wrong.

0 comments on commit a8fbf82

Please sign in to comment.