Skip to content
This repository
Browse code

fixed SI type bug in DefaultResourceAllocations and improved spotinst…

…ances.conf file
  • Loading branch information...
commit 7aaf7e5caa926b6002ecea33f79220dee4ce0edd 1 parent b7303ff
Paulo Ricardo Motta Gomes authored August 10, 2010
40  ...src/org/nimbustools/messaging/gt4_0_elastic/v2008_05_05/general/defaults/DefaultResourceAllocations.java
@@ -170,8 +170,17 @@ public void setVmmVersion(String vmmVersion) {
170 170
         this.vmmVersion = vmmVersion;
171 171
     }
172 172
     
173  
-    public void setSiType(String siType) {
174  
-        this.siType = siType;
  173
+    public void setSiType(String siType) throws Exception {
  174
+        if(siType.equalsIgnoreCase("small")){
  175
+            this.siType = this.getSmallName();
  176
+        } else if(siType.equalsIgnoreCase("large")){
  177
+            this.siType = this.getLargeName();
  178
+        } else if(siType.equalsIgnoreCase("xlarge")){
  179
+            this.siType = this.getXlargeName();
  180
+        } else {
  181
+            throw new Exception("Invalid SI type in spotinstances configuration file. " +
  182
+            		            "Valid values are: small, large or xlarge");
  183
+        }
175 184
     }    
176 185
 
177 186
     // -------------------------------------------------------------------------
@@ -252,16 +261,9 @@ public ResourceAllocation getMatchingRA(String name,
252 261
                     		" Currently supported SI type: " + siType);            
253 262
         }
254 263
         
255  
-        if (cmpName.equals(this.getSmallName())) {
256  
-            ra.setMemory(this.smallMemory);
257  
-        } else if (cmpName.equals(this.getLargeName())) {
258  
-            ra.setMemory(this.largeMemory);
259  
-        } else if (cmpName.equals(this.getXlargeName())) {
260  
-            ra.setMemory(this.xlargeMemory);
261  
-        } else {
262  
-            throw new CannotTranslateException(
263  
-                    "Unknown instance type '" + name + "'");
264  
-        }
  264
+        Integer memory = getInstanceMemory(cmpName);
  265
+        
  266
+        ra.setMemory(memory);
265 267
         
266 268
         ra.setSpotInstance(spot);
267 269
         
@@ -270,6 +272,20 @@ public ResourceAllocation getMatchingRA(String name,
270 272
         return ra;
271 273
     }
272 274
 
  275
+    protected Integer getInstanceMemory(final String cmpName)
  276
+            throws CannotTranslateException {
  277
+        if (cmpName.equals(this.getSmallName())) {
  278
+            return this.smallMemory;
  279
+        } else if (cmpName.equals(this.getLargeName())) {
  280
+            return this.largeMemory;
  281
+        } else if (cmpName.equals(this.getXlargeName())) {
  282
+            return this.xlargeMemory;
  283
+        } else {
  284
+            throw new CannotTranslateException(
  285
+                    "Unknown instance type '" + cmpName + "'");
  286
+        }
  287
+    }
  288
+
273 289
     public RequiredVMM getRequiredVMM() {
274 290
         return this.requestThisVMM;
275 291
     }
42  service/service/java/source/etc/workspace-service/spotinstances.conf
... ...
@@ -1,14 +1,16 @@
1 1
 ######################################################
2  
-#
3  
-# This file is used for configuring asynchronous
4  
-# requests (Spot Instances and
5  
-# backfill requests) for this site
6  
-#
  2
+#                                                    #
  3
+# This file is used for configuring asynchronous     #
  4
+# requests (Spot Instances and                       #
  5
+# backfill requests) for this site                   #
  6
+#                                                    #
7 7
 ######################################################
8 8
 
9  
-###########################
10  
-# GENERAL CONFIGURATION:
11  
-###########################
  9
+################################################################################
  10
+#
  11
+# General settings
  12
+#
  13
+################################################################################
12 14
 
13 15
 # Indicates whether the Spot Instances feature
14 16
 # is enabled (true) or disabled (false) for this site
@@ -20,6 +22,12 @@ si.enabled=true
20 22
 
21 23
 backfill.enabled=true
22 24
 
  25
+################################################################################
  26
+#
  27
+# Spot Instances settings
  28
+#
  29
+################################################################################
  30
+
23 31
 # A pricing model is invoked every time the Spot Instances
24 32
 # environment changes. This can happen in many situations:
25 33
 # when a request arrives, is canceled or terminated, when
@@ -57,21 +65,17 @@ backfill.enabled=true
57 65
 
58 66
 si.pricingmodel=org.globus.workspace.async.pricingmodel.MaximizeUtilizationPricingModel
59 67
 
60  
-####################################
61  
-# BASIC SPOT INSTANCE CONFIGURATION:
62  
-####################################
63  
-
64 68
 # Defines the instance type that will become
65 69
 # available as spot instances
66 70
 # 
67  
-# The supported instance types are:
  71
+# Supported instance types are:
68 72
 # small, large and xlarge.
69 73
 #
70 74
 # The amount of memory for each instance type
71 75
 # is defined in the elastic.conf file.
72 76
 #
73  
-# Currently, Nimbus only supports one type
74  
-# of Spot Instance type per site.
  77
+# Currently, Nimbus supports only one
  78
+# Spot Instance type per site.
75 79
 
76 80
 si.instancetype=small
77 81
 
@@ -81,9 +85,11 @@ si.instancetype=small
81 85
 si.minprice=0.1
82 86
 
83 87
 
84  
-#############################
85  
-# MEMORY MANAGEMENT POLICIES:
86  
-#############################
  88
+################################################################################
  89
+#
  90
+# Memory Management Policies
  91
+#
  92
+################################################################################
87 93
 
88 94
 # The policies below define how the total resource pool memory is    #
89 95
 # divided between ordinary Workspace Service requests                # 

0 notes on commit 7aaf7e5

Please sign in to comment.
Something went wrong with that request. Please try again.