(self, config, simulator)
:param config: a configuration dictionary that follows the SFR launch configuration schema.  Not all values
            needed for the SFR config are required here.  Specifically, we require the following elements:
            {
                'LaunchSpecifications': [
                    {
                        'InstanceType': AWS EC2 instance type name,
                        'SubnetId': Subnet the instance should be launched in (should map to a region in common/aws.py),
                        'SpotPrice': How much, in terms of price per unit capacity, to bid in this market,
                        'WeightedCapacity': How much to weight instances in this market by when calculating capacity
                    },
                    ...
                ]
            }
:param config: a configuration dictionary that follows the SFR launch configuration schema.  Not all values
            needed for the SFR config are required here.  Specifically, we require the following elements:
            {
                'LaunchSpecifications': [
                    {
                        'InstanceType': AWS EC2 instance type name,
                        'SubnetId': Subnet the instance should be launched in (should map to a region in common/aws.py),
                        'SpotPrice': How much, in terms of price per unit capacity, to bid in this market,
                        'WeightedCapacity': How much to weight instances in this market by when calculating capacity
                    },
                    ...
                ]
            }
: param config : a configuration dictionary that follows the SFR launch configuration schema . Not all values needed for the SFR config are required here . Specifically we require the following elements : { LaunchSpecifications : [ { InstanceType : AWS EC2 instance type name SubnetId : Subnet the instance should be launched in ( should map to a region in common / aws . py ) SpotPrice : How much in terms of price per unit capacity to bid in this market WeightedCapacity : How much to weight instances in this market by when calculating capacity } ... ] }
def __init__(self, config, simulator):
        """
        :param config: a configuration dictionary that follows the SFR launch configuration schema.  Not all values
            needed for the SFR config are required here.  Specifically, we require the following elements:
            {
                'LaunchSpecifications': [
                    {
                        'InstanceType': AWS EC2 instance type name,
                        'SubnetId': Subnet the instance should be launched in (should map to a region in common/aws.py),
                        'SpotPrice': How much, in terms of price per unit capacity, to bid in this market,
                        'WeightedCapacity': How much to weight instances in this market by when calculating capacity
                    },
                    ...
                ]
            }
        """
        SimulatedAWSCluster.__init__(self, simulator)
        AWSResourceGroup.__init__(self, f"ssfr-{uuid4()}")
        self._instance_types = {}
        for spec in config["LaunchSpecifications"]:
            bid_price = float(spec["SpotPrice"]) * spec["WeightedCapacity"]
            market = get_instance_market(spec)
            self._instance_types[market] = SpotMarketConfig(bid_price, spec["WeightedCapacity"])

        self.__target_capacity = 0
        self.allocation_strategy = config["AllocationStrategy"]
        if self.allocation_strategy != "diversified":
            raise NotImplementedError(f"{self.allocation_strategy} not supported")
def __init__ ( self , config , simulator ) : SimulatedAWSCluster . __init__ ( self , simulator ) AWSResourceGroup . __init__ ( self , f"ssfr-{uuid4()}" ) self . _instance_types = { } for spec in config [ "LaunchSpecifications" ] : bid_price = float ( spec [ "SpotPrice" ] ) * spec [ "WeightedCapacity" ] market = get_instance_market ( spec ) self . _instance_types [ market ] = SpotMarketConfig ( bid_price , spec [ "WeightedCapacity" ] ) self . __target_capacity = 0 self . allocation_strategy = config [ "AllocationStrategy" ] if self . allocation_strategy != "diversified" : raise NotImplementedError ( f"{self.allocation_strategy} not supported" )