Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed SI type bug in DefaultResourceAllocations and improved spotinst…

…ances.conf file
  • Loading branch information...
commit 7aaf7e5caa926b6002ecea33f79220dee4ce0edd 1 parent b7303ff
@pauloricardomg pauloricardomg authored
View
40 ...ools/messaging/gt4_0_elastic/v2008_05_05/general/defaults/DefaultResourceAllocations.java
@@ -170,8 +170,17 @@ public void setVmmVersion(String vmmVersion) {
this.vmmVersion = vmmVersion;
}
- public void setSiType(String siType) {
- this.siType = siType;
+ public void setSiType(String siType) throws Exception {
+ if(siType.equalsIgnoreCase("small")){
+ this.siType = this.getSmallName();
+ } else if(siType.equalsIgnoreCase("large")){
+ this.siType = this.getLargeName();
+ } else if(siType.equalsIgnoreCase("xlarge")){
+ this.siType = this.getXlargeName();
+ } else {
+ throw new Exception("Invalid SI type in spotinstances configuration file. " +
+ "Valid values are: small, large or xlarge");
+ }
}
// -------------------------------------------------------------------------
@@ -252,16 +261,9 @@ public ResourceAllocation getMatchingRA(String name,
" Currently supported SI type: " + siType);
}
- if (cmpName.equals(this.getSmallName())) {
- ra.setMemory(this.smallMemory);
- } else if (cmpName.equals(this.getLargeName())) {
- ra.setMemory(this.largeMemory);
- } else if (cmpName.equals(this.getXlargeName())) {
- ra.setMemory(this.xlargeMemory);
- } else {
- throw new CannotTranslateException(
- "Unknown instance type '" + name + "'");
- }
+ Integer memory = getInstanceMemory(cmpName);
+
+ ra.setMemory(memory);
ra.setSpotInstance(spot);
@@ -270,6 +272,20 @@ public ResourceAllocation getMatchingRA(String name,
return ra;
}
+ protected Integer getInstanceMemory(final String cmpName)
+ throws CannotTranslateException {
+ if (cmpName.equals(this.getSmallName())) {
+ return this.smallMemory;
+ } else if (cmpName.equals(this.getLargeName())) {
+ return this.largeMemory;
+ } else if (cmpName.equals(this.getXlargeName())) {
+ return this.xlargeMemory;
+ } else {
+ throw new CannotTranslateException(
+ "Unknown instance type '" + cmpName + "'");
+ }
+ }
+
public RequiredVMM getRequiredVMM() {
return this.requestThisVMM;
}
View
42 service/service/java/source/etc/workspace-service/spotinstances.conf
@@ -1,14 +1,16 @@
######################################################
-#
-# This file is used for configuring asynchronous
-# requests (Spot Instances and
-# backfill requests) for this site
-#
+# #
+# This file is used for configuring asynchronous #
+# requests (Spot Instances and #
+# backfill requests) for this site #
+# #
######################################################
-###########################
-# GENERAL CONFIGURATION:
-###########################
+################################################################################
+#
+# General settings
+#
+################################################################################
# Indicates whether the Spot Instances feature
# is enabled (true) or disabled (false) for this site
@@ -20,6 +22,12 @@ si.enabled=true
backfill.enabled=true
+################################################################################
+#
+# Spot Instances settings
+#
+################################################################################
+
# 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
@@ -57,21 +65,17 @@ backfill.enabled=true
si.pricingmodel=org.globus.workspace.async.pricingmodel.MaximizeUtilizationPricingModel
-####################################
-# BASIC SPOT INSTANCE CONFIGURATION:
-####################################
-
# Defines the instance type that will become
# available as spot instances
#
-# The supported instance types are:
+# Supported instance types are:
# small, large and xlarge.
#
# The amount of memory for each instance type
# is defined in the elastic.conf file.
#
-# Currently, Nimbus only supports one type
-# of Spot Instance type per site.
+# Currently, Nimbus supports only one
+# Spot Instance type per site.
si.instancetype=small
@@ -81,9 +85,11 @@ si.instancetype=small
si.minprice=0.1
-#############################
-# MEMORY MANAGEMENT POLICIES:
-#############################
+################################################################################
+#
+# Memory Management Policies
+#
+################################################################################
# The policies below define how the total resource pool memory is #
# divided between ordinary Workspace Service requests #
Please sign in to comment.
Something went wrong with that request. Please try again.