示例#1
0
    def prepare_xact(self, xact_info, action, ks_path, msg):
        """Prepare callback for xacts
        """
        rsp_flavor = msg.xact_detail

        if rsp_flavor in self.xact_config.rsp_flavors:
            self.statistics.send_rsps += 1
            xact_detail = self.xact_config.get_xact_detail(rsp_flavor)
            msg = xact_detail.generate_content()
            xact_info.respond_xpath(rwdts.XactRspCode.ACK, xact_detail.xpath,
                                    msg)
            return

        # If not a valid rsp_flavor send NA.
        xpath = ks_path.to_xpath(rwdtsperf.get_schema())
        xact_info.respond_xpath(rwdts.XactRspCode.NA, xpath)
示例#2
0
    def handle_perf_statistics(self, xact_info, action, ks_path, msg):
        """
        On prepare callback for /perf-statistics
        """
        # Wildcard
        if msg.instance_id != 0 and msg.instance_id != self.instance_id:
            self.log.debug("Instance {}: Got perf-statistics msg for instance_id {}."
                    "Sending NA".format(self.instance_id, msg.instance_id))
            xpath = ks_path.to_xpath(rwdtsperf.get_schema())
            xact_info.respond_xpath(rwdts.XactRspCode.NA, xpath)
            return

        # once the DTS issue has been fixed, change msg.instance_id to self.
        xpath = "/rwdtsperf:perf-statistics[rwdtsperf:instance-id='{}']".format(
                self.instance_id)
        stats = self.statistics.get_gi_object()
        xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath, stats)
示例#3
0
    def prepare_xact(self, xact_info, action, ks_path, msg):
        """Prepare callback for xacts
        """
        rsp_flavor = msg.xact_detail

        if rsp_flavor in self.xact_config.rsp_flavors:
            self.statistics.send_rsps += 1
            xact_detail = self.xact_config.get_xact_detail(rsp_flavor)
            msg = xact_detail.generate_content()
            xact_info.respond_xpath(
                rwdts.XactRspCode.ACK,
                xact_detail.xpath,
                msg)
            return

        # If not a valid rsp_flavor send NA.
        xpath = ks_path.to_xpath(rwdtsperf.get_schema())
        xact_info.respond_xpath(rwdts.XactRspCode.NA, xpath)
示例#4
0
    def handle_perf_statistics(self, xact_info, action, ks_path, msg):
        """
        On prepare callback for /perf-statistics
        """
        # Wildcard
        if msg.instance_id != 0 and msg.instance_id != self.instance_id:
            self.log.debug(
                "Instance {}: Got perf-statistics msg for instance_id {}."
                "Sending NA".format(self.instance_id, msg.instance_id))
            xpath = ks_path.to_xpath(rwdtsperf.get_schema())
            xact_info.respond_xpath(rwdts.XactRspCode.NA, xpath)
            return

        # once the DTS issue has been fixed, change msg.instance_id to self.
        xpath = "/rwdtsperf:perf-statistics[rwdtsperf:instance-id='{}']".format(
            self.instance_id)
        stats = self.statistics.get_gi_object()
        xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath, stats)
示例#5
0
    def handle_start_xact(self, xact_info, action, ks_path, msg):
        """On prepare callback for /start-xact rpc
        """
        xpath = ks_path.to_xpath(rwdtsperf.get_schema())
        # Check if the instance can respond to the xpath
        if msg.instance_id != self.instance_id:
            xact_info.respond_xpath(rwdts.XactRspCode.NA, xpath)
            return

        if self.state == TaskletState.RUNNING:
            xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath)
            return

        xact_detail = next(self.xact_config.xacts)
        self.state = TaskletState.RUNNING
        xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath)

        self.log.info("Starting RwDtsPerfTasklet id: {}".format(self.instance_id))
        self.send_xact(xact_detail)
示例#6
0
    def handle_start_xact(self, xact_info, action, ks_path, msg):
        """On prepare callback for /start-xact rpc
        """
        xpath = ks_path.to_xpath(rwdtsperf.get_schema())
        # Check if the instance can respond to the xpath
        if msg.instance_id != self.instance_id:
            xact_info.respond_xpath(rwdts.XactRspCode.NA, xpath)
            return

        if self.state == TaskletState.RUNNING:
            xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath)
            return

        xact_detail = next(self.xact_config.xacts)
        self.state = TaskletState.RUNNING
        xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath)

        self.log.info("Starting RwDtsPerfTasklet id: {}".format(
            self.instance_id))
        self.send_xact(xact_detail)
示例#7
0
    def start(self):
        """Entry point for tasklet
        """
        self.log.setLevel(logging.INFO)
        super().start()

        self._dts = rift.tasklets.DTS(self.tasklet_info,
                                      rwdtsperf.get_schema(), self._loop,
                                      self.on_dts_state_change)

        # Set the instance id
        self.instance_name = self.tasklet_info.instance_name
        self.instance_id = int(self.instance_name.rsplit('-', 1)[1])
        self.log.debug("Starting RwDtsPerfTasklet Name: {}, Id: {}".format(
            self.instance_name, self.instance_id))

        self.state = TaskletState.STARTING
        self.xact_config = None  # Will contain the TestConfig data
        self.statistics = Statistics(self)
        # A container to hold the current outstanding transactions
        self.curr_xacts = {}
示例#8
0
    def start(self):
        """Entry point for tasklet
        """
        self.log.setLevel(logging.INFO)
        super().start()

        self._dts = rift.tasklets.DTS(
                self.tasklet_info,
                rwdtsperf.get_schema(),
                self._loop,
                self.on_dts_state_change)

        # Set the instance id
        self.instance_name = self.tasklet_info.instance_name
        self.instance_id = int(self.instance_name.rsplit('-', 1)[1])
        self.log.debug("Starting RwDtsPerfTasklet Name: {}, Id: {}".format(
                self.instance_name,
                self.instance_id))

        self.state = TaskletState.STARTING
        self.xact_config = None  # Will contain the TestConfig data
        self.statistics = Statistics(self)
        # A container to hold the current outstanding transactions
        self.curr_xacts = {}