コード例 #1
0
ファイル: agent.py プロジェクト: VOLTTRON/volttron
    def scrape_ending(self, topic):
        if not self.scalability_test:
            return
        
        try:
            self.waiting_to_finish.remove(topic)
        except KeyError:
            _log.warning(topic + " published twice before test finished, increase the length of scrape interval and rerun test")

        if not self.waiting_to_finish:
            end = datetime.now()
            delta = end - self.current_test_start
            delta = delta.total_seconds()
            self.test_results.append(delta)
            
            self.test_iterations += 1
            
            _log.info("publish {} took {} seconds".format(self.test_iterations, delta))
            
            if self.test_iterations >= self.scalability_test_iterations:
                #Test is now over. Button it up and shutdown.
                mean = math_utils.mean(self.test_results) 
                stdev = math_utils.stdev(self.test_results) 
                _log.info("Mean total publish time: "+str(mean))
                _log.info("Std dev publish time: "+str(stdev))
                sys.exit(0)
コード例 #2
0
    def scrape_ending(self, topic):
        if not self.scalability_test:
            return

        try:
            self.waiting_to_finish.remove(topic)
        except KeyError:
            _log.warning(
                topic +
                " published twice before test finished, increase the length of scrape interval and rerun test"
            )

        if not self.waiting_to_finish:
            end = datetime.now()
            delta = end - self.current_test_start
            delta = delta.total_seconds()
            self.test_results.append(delta)

            self.test_iterations += 1

            _log.info("publish {} took {} seconds".format(
                self.test_iterations, delta))

            if self.test_iterations >= self.scalability_test_iterations:
                #Test is now over. Button it up and shutdown.
                mean = math_utils.mean(self.test_results)
                stdev = math_utils.stdev(self.test_results)
                _log.info("Mean total publish time: " + str(mean))
                _log.info("Std dev publish time: " + str(stdev))
                sys.exit(0)
コード例 #3
0
ファイル: agent.py プロジェクト: rkini-pnnl/volttron-GS
 def determine_prices(self):
     try:
         if self.prices:
             avg_price = mean(self.prices)
             std_price = stdev(self.prices)
             price_min = avg_price - self.price_multiplier * std_price
             price_max = avg_price + self.price_multiplier * std_price
         else:
             price_min = self.default_min_price
             price_max = self.default_max_price
     except:
         price_min = self.default_min_price
         price_max = self.default_max_price
     return price_min, price_max
コード例 #4
0
 def determine_prices(self):
     if self.prices:
         avg_price = mean(self.prices)
         std_price = stdev(self.prices)
         price_min = avg_price - self.price_multiplier * std_price
         price_max = avg_price + self.price_multiplier * std_price
         _log.debug(
             '{}: price debug avg {} - std_dev: {} - min: {} - max: {}'.
             format(self.agent_name, avg_price, std_price, price_min,
                    price_max))
     else:
         price_min = self.default_min_price
         price_max = self.default_max_price
     price_array = np.linspace(price_min, price_max, 11)
     return price_array
コード例 #5
0
 def determine_prices(self):
     """
     Determine minimum and maximum price from 24-hour look ahead prices.  If the TNS
     market architecture is not utilized, this function must be overwritten in the child class.
     :return:
     """
     if self.market_prices:
         avg_price = mean(self.market_prices)
         std_price = stdev(self.market_prices)
         price_min = avg_price - self.price_multiplier * std_price
         price_max = avg_price + self.price_multiplier * std_price
     else:
         avg_price = None
         std_price = None
         price_min = self.default_min_price
         price_max = self.default_max_price
     _log.debug("Prices: {} - avg: {} - std: {}".format(self.market_prices, avg_price, std_price))
     price_array = np.linspace(price_min, price_max, 11)
     return price_array
コード例 #6
0
        def publish_to_historian(self, to_publish_list):

            for item in to_publish_list:
                if self._gather_timing_data:
                    turnaround_time = add_timing_data_to_header(item["headers"],
                                                                self.core.agent_uuid or self.core.identity,
                                                                "published")
                    self._turnaround_times.append(turnaround_time)
                    if len(self._turnaround_times) > 10000:
                        # Test is now over. Button it up and shutdown.
                        mean = math_utils.mean(self._turnaround_times)
                        stdev = math_utils.stdev(self._turnaround_times)
                        _log.info("Mean time from collection to publish: " + str(mean))
                        _log.info("Std dev time from collection to publish: " + str(stdev))
                        self._turnaround_times = []
                #_log.debug("publishing {}".format(item))

            _log.debug("recieved {} items to publish"
                       .format(len(to_publish_list)))

            self.report_all_handled()
コード例 #7
0
ファイル: agent.py プロジェクト: Kisensum/volttron
        def publish_to_historian(self, to_publish_list):

            for item in to_publish_list:
                if self._gather_timing_data:
                    turnaround_time = add_timing_data_to_header(item["headers"],
                                                                self.core.agent_uuid or self.core.identity,
                                                                "published")
                    self._turnaround_times.append(turnaround_time)
                    if len(self._turnaround_times) > 10000:
                        # Test is now over. Button it up and shutdown.
                        mean = math_utils.mean(self._turnaround_times)
                        stdev = math_utils.stdev(self._turnaround_times)
                        _log.info("Mean time from collection to publish: " + str(mean))
                        _log.info("Std dev time from collection to publish: " + str(stdev))
                        self._turnaround_times = []
                #_log.debug("publishing {}".format(item))

            _log.debug("recieved {} items to publish"
                       .format(len(to_publish_list)))

            self.report_all_handled()