def run(self, args): info = sysfsinfo() resources = [] # let's monkey patch the error sysfs resource # by looking at our dicionaries of error parsers and matching # them with the corresponding property and then replacing # that property attribute with an instance of the error parsing # class with the value of the property if args.which == "fme" or args.which == "all": for fme in info.fme(**vars(args)): set_error_parsers(fme.errors, error_classes["fme"]) resources.append(fme.errors) if args.which == "port" or args.which == "all": for port in info.port(**vars(args)): set_error_parsers(port.errors, error_classes["port"]) resources.append(port.errors) json_data = [] for r in resources: if args.json: json_data.append(r.to_dict()) else: r.print_info( "//****** {} ******//".format(r.name())) if args.json: print(json.dumps(json_data, indent=4, sort_keys=False)) if args.clear: for r in resources: if not r.clear(): print("ERROR: Could not clear errors for resource {}.\n" "Are you running as root?\n".format(r.sysfs_path))
def run(self, args): info = sysfsinfo() resources = [] # let's monkey patch the error sysfs resource # by looking at our dicionaries of error parsers and matching # them with the corresponding property and then replacing # that property attribute with an instance of the error parsing # class with the value of the property if args.which == "fme" or args.which == "all": for fme in info.fme(**vars(args)): set_error_parsers(fme.errors, error_classes["fme"]) resources.append(fme.errors) if args.which == "port" or args.which == "all": for port in info.port(**vars(args)): set_error_parsers(port.errors, error_classes["port"]) resources.append(port.errors) json_data = [] for r in resources: if args.json: json_data.append(r.to_dict(True)) else: r.print_info( "//****** {} ******//".format(r.name())) if args.json: print(json.dumps(json_data, indent=4, sort_keys=False)) if args.clear: for r in resources: if not r.clear(): print("ERROR: Could not clear errors for resource {}.\n" "Are you running as root?\n".format(r.sysfs_path))
def run(self, args): info = sysfs.sysfsinfo() json_data = [] for fme in info.fme(**vars(args)): if args.json: json_data.append(fme.to_dict()) else: fme.print_info("//****** FME ******//", *self.properties) if args.json: print(json.dumps(json_data, indent=4, sort_keys=False))
def run(self, args): info = sysfs.sysfsinfo() json_data = [] for port in info.port(**vars(args)): if args.json: json_data.append(port.to_dict()) else: port.print_info("//****** PORT ******//", *self.properties) if args.json: print(json.dumps(json_data, indent=4, sort_keys=False))
def run(self, args): info = sysfs.sysfsinfo() for fme in info.fme(**vars(args)): if info.device() != fpga_common.DCP_ID: fme.power_mgmt.print_info( "//****** POWER ******//", "consumed", consumed=lambda v: '{} Watts'.format(v)) else: fme.power_mgmt.print_info("*** POWER Not supported on HW ***", "", consumed=lambda v: '{} W'.format(v))
def run(self, args): info = sysfs.sysfsinfo() for fme in info.fme(**vars(args)): fme.thermal_mgmt.print_info("//****** THERMAL ******//", *[p[0] for p in self.thermal_props], **dict(self.thermal_props))
def run(self, args): info = sysfs.sysfsinfo() for fme in info.fme(**vars(args)): fme.power_mgmt.print_info("//****** POWER ******//", "consumed", consumed=lambda v: '{} Watts'.format(v))