(
        self,
        metadata,
        start_time,
        end_time,
        autoscaler_config_file=None,
        metrics_client=None,
        billing_frequency=timedelta(seconds=1),
        refund_outbid=True,
    )
Maintains all of the state for a clusterman simulation

        :param metadata: a SimulationMetadata object
        :param start_time: an arrow object indicating the start of the simulation
        :param end_time: an arrow object indicating the end of the simulation
        :param autoscaler_config_file: a filename specifying a list of existing SFRs or SFR configs
        :param billing_frequency: a timedelta object indicating how often to charge for an instance
        :param refund_outbid: if True, do not incur any cost for an instance lost to an outbid event
Maintains all of the state for a clusterman simulation
Maintains all of the state for a clusterman simulation
def __init__(
        self,
        metadata,
        start_time,
        end_time,
        autoscaler_config_file=None,
        metrics_client=None,
        billing_frequency=timedelta(seconds=1),
        refund_outbid=True,
    ) -> None:
        """ Maintains all of the state for a clusterman simulation

        :param metadata: a SimulationMetadata object
        :param start_time: an arrow object indicating the start of the simulation
        :param end_time: an arrow object indicating the end of the simulation
        :param autoscaler_config_file: a filename specifying a list of existing SFRs or SFR configs
        :param billing_frequency: a timedelta object indicating how often to charge for an instance
        :param refund_outbid: if True, do not incur any cost for an instance lost to an outbid event
        """
        self.autoscaler: Optional[Autoscaler] = None
        self.metadata = metadata
        self.metrics_client = metrics_client
        self.start_time = start_time
        self.current_time = start_time
        self.end_time = end_time

        self.instance_prices: Mapping[InstanceMarket, PiecewiseConstantFunction] = defaultdict(
            lambda: PiecewiseConstantFunction()
        )
        self.cost_per_hour: SimFn = PiecewiseConstantFunction()
        self.aws_cpus: SimFn = PiecewiseConstantFunction()
        self.mesos_cpus: SimFn = PiecewiseConstantFunction()
        self.mesos_cpus_allocated: SimFn = PiecewiseConstantFunction()
        self.markets: Set = set()

        self.billing_frequency = billing_frequency
        self.refund_outbid = refund_outbid

        if autoscaler_config_file:
            self._make_autoscaler(autoscaler_config_file)
            self.aws_clusters = self.autoscaler.pool_manager.resource_groups.values()  # type: ignore
            period = self.autoscaler.signal.period_minutes  # type: ignore
            print(f"Autoscaler configured; will run every {period} minutes")
        else:
            self.aws_clusters = [SimulatedAWSCluster(self)]
            print("No autoscaler configured; using metrics for cluster size")

        # The event queue holds all of the simulation events, ordered by time
        self.event_queue: List[Event] = []

        # Don't use add_event here or the end_time event will get discarded
        heappush(self.event_queue, Event(self.start_time, msg="Simulation begins"))
        heappush(self.event_queue, Event(self.end_time, msg="Simulation ends"))
def __init__ ( self , metadata , start_time , end_time , autoscaler_config_file = None , metrics_client = None , billing_frequency = timedelta ( seconds = 1 ) , refund_outbid = True , ) -> None : self . autoscaler : Optional [ Autoscaler ] = None self . metadata = metadata self . metrics_client = metrics_client self . start_time = start_time self . current_time = start_time self . end_time = end_time self . instance_prices : Mapping [ InstanceMarket , PiecewiseConstantFunction ] = defaultdict ( lambda : PiecewiseConstantFunction ( ) ) self . cost_per_hour : SimFn = PiecewiseConstantFunction ( ) self . aws_cpus : SimFn = PiecewiseConstantFunction ( ) self . mesos_cpus : SimFn = PiecewiseConstantFunction ( ) self . mesos_cpus_allocated : SimFn = PiecewiseConstantFunction ( ) self . markets : Set = set ( ) self . billing_frequency = billing_frequency self . refund_outbid = refund_outbid if autoscaler_config_file : self . _make_autoscaler ( autoscaler_config_file ) self . aws_clusters = self . autoscaler . pool_manager . resource_groups . values ( ) # type: ignore period = self . autoscaler . signal . period_minutes # type: ignore print ( f"Autoscaler configured; will run every {period} minutes" ) else : self . aws_clusters = [ SimulatedAWSCluster ( self ) ] print ( "No autoscaler configured; using metrics for cluster size" ) # The event queue holds all of the simulation events, ordered by time self . event_queue : List [ Event ] = [ ] # Don't use add_event here or the end_time event will get discarded heappush ( self . event_queue , Event ( self . start_time , msg = "Simulation begins" ) ) heappush ( self . event_queue , Event ( self . end_time , msg = "Simulation ends" ) )