Commits

Tobias Wohlfrom  committed d2256f4

Added function to retrieve number of available slots on instance

  • Participants
  • Parent commits d300804

Comments (0)

Files changed (2)

File cm/clouds/ec2.py

                 except IOError:
                     pass
         return self.instance_type
+
+    def get_slots( self ):
+        n_slots = 1
+        instance_type = self.get_type()
+        if instance_type in ["t1.micro","m1.small"]:
+            n_slots = 1
+        elif instance_type in ["m1.large","c1.medium","m2.xlarge"]:
+            n_slots = 2
+        elif instance_type in ["m1.xlarge","m2.2xlarge"]:
+            n_slots = 4
+        elif instance_type in ["c1.xlarge","m2.4xlarge"]:
+            n_slots = 8
+        elif instance_type in ["cc1.4xlarge"]:
+            n_slots = 16
+        log.debug('Instance type %s has %d slots' % (instance_type, n_slots))
+        return n_slots
     
     def get_instance_id( self ):
         if self.instance_id is None:

File cm/clouds/local.py

                 except IOError:
                     pass
         return self.instance_type
+
+    def get_slots( self ):
+        n_slots = 1
+        instance_type = self.get_type()
+        log.debug('Instance type %s has %d slots' % (instance_type, n_slots))
+        return n_slots
     
     def get_instance_id( self ):
         if self.instance_id is None: