Best Python code snippet using lisa_python
utils.py
Source:utils.py
...38 "CasA,f|J,23:23:27.94,+58:48:42.4,1",39 "3C196,f|J,08:13:36.06,+48:13:02.6,1",40 "3C286,f|J,13:31:08.29,+30:30:33.0,1",41 "3C295,f|J,14:11:20.47,+52:12:09.5,1", ]42def get_numa_node_count():43 # Query lscpu44 lscpu = subprocess.Popen(['lscpu',], stdout=subprocess.PIPE, stderr=subprocess.PIPE)45 output, error = lscpu.communicate()46 try:47 output = output.decode()48 error = error.decode()49 except AttributeError:50 pass51 output = output.split('\n')52 53 # Look for the number of NUMA nodes54 nn = 155 for line in output:56 if line.find('NUMA node(s)') != -1:57 nn = int(line.rsplit(':', 1)[1], 10)58 return nn59def get_numa_support():60 # Check the number of NUMA nodes61 nn = get_numa_node_count()62 63 # Check for the numactl utility64 devnull = open('/dev/null', 'wb')65 numactl = subprocess.call(['which', 'numactl'], stdout=devnull, stderr=devnull)66 devnull.close()67 68 # If we have more than one NUMA node and numactl we are good to go69 status = False70 if numactl == 0 and nn > 1:71 status = True72 73 return status74def get_gpu_count():75 # Query nvidia-smi...
launchJobs.py
Source:launchJobs.py
...153 returnQueue.put(False)154 return False155 156 # Query the NUMA status157 scode, numa_status = run_command("%s -c 'from __future__ import print_function; import utils; print(utils.get_numa_support(), utils.get_numa_node_count())'" % (sys.executable,), node=node, cwd=cwd, return_output=True)158 code += scode159 if code != 0:160 print("WARNING: failed to determine NUMA status on %s - %s" % (node, os.path.basename(configfile)))161 returnQueue.put(False)162 return False163 numa_support, numa_node_count = numa_status.split(None, 1)164 if numa_support == 'False':165 ## Nope, drop the socket number166 socket = None167 else:168 ## Yep, make sure the socket number is in range169 socket = socket % int(numa_node_count, 10)170 171 if options.find('--gpu') != -1 and options.find('--gpu=') == -1:...
lscpu.py
Source:lscpu.py
...215 l3_cache=match_result.group("l3_cache"),216 )217 )218 return output219 def get_numa_node_count(self) -> int:220 # get count of numa nodes on the machine, add 1 to account221 # for 0 indexing222 return max([int(cpu.numa_node) for cpu in self.get_cpu_info()]) + 1223 def is_virtualization_enabled(self) -> bool:224 result = self.run(sudo=True).stdout225 if ("VT-x" in result) or ("AMD-V" in result):226 return True227 return False228class WindowsLscpu(Lscpu):229 @property230 def command(self) -> str:231 return ""232 def _check_exists(self) -> bool:233 return True...
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!!