示例#1
0
    def test_high_temp_parse(self):
        gpu_stat = computer_monitor.parse_smi_output(self.high_temp_data)

        # Check valid
        self.assert_(self.high_temp_data,
                     "Unable to read sample output, no test to run")

        # Check all string fields of message
        self.assert_(gpu_stat.pci_device_id, "No PCI Device ID found")
        self.assert_(gpu_stat.pci_location, "No PCI Location found")
        self.assert_(gpu_stat.display, "No Display found")
        self.assert_(gpu_stat.driver_version, "No Driver Version found")
        self.assert_(gpu_stat.product_name, "No Product Name found")

        self.assert_(
            gpu_stat.temperature > 90,
            "Invalid temperature readings. Temperature: %d" %
            gpu_stat.temperature)
        self.assert_(
            gpu_stat.fan_speed > 0 and gpu_stat.fan_speed < 471,
            "Invalid fan speed readings. Fan Speed %s" % gpu_stat.fan_speed)

        diag_stat = computer_monitor.gpu_status_to_diag(gpu_stat)

        self.assert_(
            diag_stat.level == 1,
            "Diagnostics didn't report warning for high temp input. Level %d, Message: %s"
            % (diag_stat.level, diag_stat.message))
示例#2
0
    def test_new_parse(self):
        gpu_stat = computer_monitor.parse_smi_output(self.data_xml)

        self.assert_(self.data_xml,
                     "Unable to read sample output, no test to run")

        self.assert_(gpu_stat.pci_device_id, "No PCI Device ID found")
        self.assert_(gpu_stat.pci_location, "No PCI Location found")
        self.assert_(gpu_stat.display, "No Display found")
        self.assert_(gpu_stat.driver_version, "No Driver Version found")
        self.assert_(gpu_stat.product_name, "No Product Name found")

        self.assert_(
            gpu_stat.temperature > 40 and gpu_stat.temperature < 90,
            "Invalid temperature readings. Temperature: %d" %
            gpu_stat.temperature)
        self.assert_(
            gpu_stat.fan_speed > 0 and gpu_stat.fan_speed < 471,
            "Invalid fan speed readings. Fan Speed %f" % gpu_stat.fan_speed)

        diag_stat = computer_monitor.gpu_status_to_diag(gpu_stat)

        self.assert_(
            diag_stat.level == 0,
            "Diagnostics reports an error for nominal input. Message: %s" %
            diag_stat.message)
示例#3
0
 def test_empty_parse(self):
     gpu_stat = computer_monitor.parse_smi_output('')
     
     self.assert_(gpu_stat.temperature == 0, "Invalid temperature reading. Should be 0. Reading: %d" % gpu_stat.temperature)
     
     diag_stat = computer_monitor.gpu_status_to_diag(gpu_stat)
     
     self.assert_(diag_stat.level == 2, "Diagnostics didn't reports an error for empty input. Level: %d, Message: %s" % (diag_stat.level, diag_stat.message))
示例#4
0
    def pub_status(self):
        gpu_stat = GPUStatus()
        stat = DiagnosticStatus()
        try:
            card_out = computer_monitor.get_gpu_status(xml=True)
            gpu_stat = computer_monitor.parse_smi_output(card_out)
            stat = computer_monitor.gpu_status_to_diag(gpu_stat, self.hostname)
        except Exception, e:
            import traceback

            rospy.logerr("Unable to process nVidia GPU data")
            rospy.logerr(traceback.format_exc())
示例#5
0
 def pub_status(self):
     gpu_stat = GPUStatus()
     stat = DiagnosticStatus()
     try:
         card_out = computer_monitor.get_gpu_status()
         gpu_stat = computer_monitor.parse_smi_output(card_out)
         stat = computer_monitor.gpu_status_to_diag(gpu_stat)
         rospy.loginfo("card_out: {}\ngpu_stat: {}\n".format(
             card_out, gpu_stat))
     except Exception, e:
         import traceback
         rospy.logerr('Unable to process nVidia GPU data')
         rospy.logerr(traceback.format_exc())
示例#6
0
 def pub_status(self):
     gpu_stat = GPUStatus()
     stat = DiagnosticStatus()
     try:
         card_out = computer_monitor.get_gpu_status(xml=True)
         gpu_stat = computer_monitor.parse_smi_output(card_out)
         stat = computer_monitor.gpu_status_to_diag(gpu_stat, self.hostname)
     except Exception, e:
         import traceback
         rospy.logerr('Unable to process nVidia GPU data')
         rospy.logerr(traceback.format_exc())
         stat.name = '%s GPU Status' % self.hostname
         stat.message = 'Could not get GPU information'
         stat.level = DiagnosticStatus.ERROR
示例#7
0
    def test_empty_parse(self):
        gpu_stat = computer_monitor.parse_smi_output('')

        self.assert_(
            gpu_stat.temperature == 0,
            "Invalid temperature reading. Should be 0. Reading: %d" %
            gpu_stat.temperature)

        diag_stat = computer_monitor.gpu_status_to_diag(gpu_stat)

        self.assert_(
            diag_stat.level == 2,
            "Diagnostics didn't reports an error for empty input. Level: %d, Message: %s"
            % (diag_stat.level, diag_stat.message))
示例#8
0
 def test_new_parse(self):
     gpu_stat = computer_monitor.parse_smi_output(self.data_xml)
     
     self.assert_(self.data_xml, "Unable to read sample output, no test to run")
     
     self.assert_(gpu_stat.pci_device_id, "No PCI Device ID found")
     self.assert_(gpu_stat.pci_location, "No PCI Location found")
     self.assert_(gpu_stat.display, "No Display found")
     self.assert_(gpu_stat.driver_version, "No Driver Version found")
     self.assert_(gpu_stat.product_name, "No Product Name found")
     
     self.assert_(gpu_stat.temperature > 40 and gpu_stat.temperature < 90, "Invalid temperature readings. Temperature: %d" % gpu_stat.temperature)
     self.assert_(gpu_stat.fan_speed > 0 and gpu_stat.fan_speed < 471, "Invalid fan speed readings. Fan Speed %f" % gpu_stat.fan_speed)
     
     diag_stat = computer_monitor.gpu_status_to_diag(gpu_stat)
     
     self.assert_(diag_stat.level == 0, "Diagnostics reports an error for nominal input. Message: %s" % diag_stat.message)
示例#9
0
    def test_high_temp_parse(self):
        gpu_stat = computer_monitor.parse_smi_output(self.high_temp_data)
        
        # Check valid
        self.assert_(self.high_temp_data, "Unable to read sample output, no test to run")

        # Check all string fields of message
        self.assert_(gpu_stat.pci_device_id, "No PCI Device ID found")
        self.assert_(gpu_stat.pci_location, "No PCI Location found")
        self.assert_(gpu_stat.display, "No Display found")
        self.assert_(gpu_stat.driver_version, "No Driver Version found")
        self.assert_(gpu_stat.product_name, "No Product Name found")

        self.assert_(gpu_stat.temperature > 90, "Invalid temperature readings. Temperature: %d" % gpu_stat.temperature)
        self.assert_(gpu_stat.fan_speed > 0 and gpu_stat.fan_speed < 471, "Invalid fan speed readings. Fan Speed %s" % gpu_stat.fan_speed)

        diag_stat = computer_monitor.gpu_status_to_diag(gpu_stat)
        
        self.assert_(diag_stat.level == 1, "Diagnostics didn't report warning for high temp input. Level %d, Message: %s" % (diag_stat.level, diag_stat.message))