Best Python code snippet using lisa_python
xbutil_gui.py
Source:xbutil_gui.py  
...316                             selected_cluster, refresh_host)317        xbutil_top.show_top_info()318        plot_metrics.plot_metrics(auto_refresh_plot_seconds)319    elif lspci_dict:320        devices_compute_units = get_devices_from_lspci(lspci_dict, alveo_spec_dict)321        update_sheet_cluster(devices_compute_units, xbutil_dump_json,322                             selected_cluster, refresh_host)323    else:324        # something wrong with current refresh host. Move on to the next host325        auto_refresh_host_idx = auto_refresh_host_idx + 1326        if auto_refresh_host_idx == len(clusters[selected_cluster_name]):327            auto_refresh_host_idx = 0328329    dump_log_file()330331    # add refresh_database back to the eventloop332    auto_refresh_plot_seconds = auto_refresh_plot_seconds + DEFAULT_XBUTIL_REFRESH_INTERVAL333    root_window.after(DEFAULT_XBUTIL_REFRESH_INTERVAL*1000, refresh_database, json_file)334
...nvme.py
Source:nvme.py  
...55            matched_result = self._namespace_cli_pattern.match(row)56            if matched_result:57                namespaces_cli.append(matched_result.group("namespace"))58        return namespaces_cli59    def get_devices_from_lspci(self) -> List[PciDevice]:60        devices_from_lspci = []61        lspci_tool = self._node.tools[Lspci]62        device_list = lspci_tool.get_devices()63        devices_from_lspci = [64            x for x in device_list if self._pci_device_name == x.device_class65        ]66        return devices_from_lspci67    def get_raw_data_disks(self) -> List[str]:68        return self.get_namespaces()69    def _get_device_from_ls(self, force_run: bool = False) -> None:70        if (not self._ls_devices) or force_run:71            execute_results = self._node.execute(72                "ls -l /dev/nvme*", shell=True, sudo=True73            )...xbutil_handler.py
Source:xbutil_handler.py  
...9899    return devices_compute_units100101102def get_devices_from_lspci(lspci_dict, alveo_spec_dict):103    devices_compute_units = {}104    device_id_names = []105    device_vbnvs = []106    device_ids = []107    compute_units = []108109    for k in lspci_dict.keys():110        device_vbnv = alveo_spec_dict['pcie_device_ids'].get(lspci_dict[k], 'NA')111        device_ids.append(k)112        device_vbnvs.append(device_vbnv)113        device_id_names.append(k + "::" + device_vbnv)114        compute_units.append([{'name': 'NA', 'usage': '-', 'status': '-'}])115    116    devices_compute_units['device_ids'] = device_ids
...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
