How to use numa_nodes_with_memory method in avocado

Best Python code snippet using avocado_python

numa_test.py

Source: numa_test.py Github

copy

Full Screen

...19from avocado import Test20from avocado import skipIf21from avocado.utils import process, build, memory, distro, genio22from avocado.utils.software_manager.manager import SoftwareManager23SINGLE_NODE = len(memory.numa_nodes_with_memory()) < 224class NumaTest(Test):25 """26 Exercises numa_move_pages and mbind call with 20% of the machine's free27 memory28 :avocado: tags=memory,migration,hugepage29 """30 def copyutil(self, file_name):31 shutil.copyfile(self.get_data(file_name),32 os.path.join(self.teststmpdir, file_name))33 def setUp(self):34 smm = SoftwareManager()35 dist = distro.detect()36 memsize = int(memory.meminfo.MemFree.b * 0.2)37 self.nr_pages = self.params.get(38 'nr_pages', default=memsize /​/​ memory.get_page_size())39 self.map_type = self.params.get('map_type', default='private')40 self.hpage = self.params.get('h_page', default=False)41 nodes = memory.numa_nodes_with_memory()42 pkgs = ['gcc', 'make']43 hp_check = 044 if self.hpage:45 hp_size = memory.get_huge_page_size()46 for node in nodes:47 genio.write_file('/​sys/​devices/​system/​node/​node%s/​hugepages/​hu'48 'gepages-%skB/​nr_hugepages' %49 (node, str(hp_size)), str(self.nr_pages))50 for node in nodes:51 hp_check += int(genio.read_file(52 '/​sys/​devices/​system/​node/​node%s/​hugepages/​hugepages-%skB'53 '/​nr_hugepages' % (node, str(hp_size))).strip())54 if hp_check < self.nr_pages:55 self.cancel('Not enough pages to be configured on nodes')...

Full Screen

Full Screen

numactl.py

Source: numactl.py Github

copy

Full Screen

...54 build.make(self.sourcedir)55 def test(self):56 if build.make(self.sourcedir, extra_args='-k -j 1'57 ' test', ignore_status=True):58 if len(memory.numa_nodes_with_memory()) < 2:59 self.log.warn('Few tests failed due to less NUMA mem-nodes')60 else:...

Full Screen

Full Screen

fixtures.py

Source: fixtures.py Github

copy

Full Screen

1"""2High performance VM test fixtures3"""4import pytest5import art.rhevm_api.tests_lib.low_level.hosts as ll_hosts6import art.rhevm_api.tests_lib.low_level.vms as ll_vms7import rhevmtests.compute.sla.high_performance_vm.config as conf8@pytest.fixture(scope="module")9def fill_numa_nodes_constants():10 """11 Fill NUMA node constants12 """13 host_numa_nodes = ll_hosts.get_numa_nodes_from_host(14 host_name=conf.HOSTS[0]15 )16 numa_nodes_with_memory = filter(17 lambda node: ll_hosts.get_numa_node_memory(numa_node_obj=node) > 0,18 host_numa_nodes19 )20 if len(numa_nodes_with_memory) < 2:21 return22 numa_nodes_with_memory.sort(key=ll_hosts.get_numa_node_index)23 conf.NUMA_NODE_0 = numa_nodes_with_memory[0]24 conf.NUMA_NODE_1 = numa_nodes_with_memory[1]25@pytest.fixture(scope="class")26def update_vm_cpu_and_numa_pinning(request):27 """28 Update VM CPU and NUMA pinning before run other fixtures29 """30 vm_params = request.node.cls.vms_to_params[conf.VM_NAME[0]]31 on_the_same_node = request.node.cls.on_the_same_node32 numa_nodes = [conf.NUMA_NODE_0, conf.NUMA_NODE_1]33 cores_number = len(numa_nodes)34 vm_params[conf.VM_CPU_CORES] = cores_number35 cpu_pinning = []36 if on_the_same_node:37 for i, node in enumerate(numa_nodes):38 node_cpu = ll_hosts.get_numa_node_cpus(numa_node_obj=node)[0]39 cpu_pinning.append({str(i): str(node_cpu)})40 else:41 node_index = ll_hosts.get_numa_node_index(42 numa_node_obj=conf.NUMA_NODE_043 )44 vm_numa_nodes_params = getattr(45 request.node.cls, "vm_numa_nodes_params", []46 )47 # Update VM NUMA node parameters48 vm_numa_nodes_params.append(49 {50 conf.NUMA_NODE_PARAMS_INDEX: 0,51 conf.NUMA_NODE_PARAMS_CORES: range(cores_number),52 conf.NUMA_NODE_PARAMS_MEMORY: ll_vms.get_vm_memory(53 vm_name=conf.VM_NAME[0]54 ) /​ conf.MB,55 conf.NUMA_NODE_PARAMS_PIN_LIST: [node_index]56 }57 )58 node_cpus = ll_hosts.get_numa_node_cpus(numa_node_obj=conf.NUMA_NODE_1)59 for i in range(cores_number):60 cpu_pinning.append({str(i): str(node_cpus[i])})61 # Update VM CPU pinning parameters...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Nov’22 Updates: Live With Automation Testing On OTT Streaming Devices, Test On Samsung Galaxy Z Fold4, Galaxy Z Flip4, &#038; More

Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.

Considering Agile Principles from a different angle

In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.

How To Choose The Best JavaScript Unit Testing Frameworks

JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.

How To Write End-To-End Tests Using Cypress App Actions

When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.

[LambdaTest Spartans Panel Discussion]: What Changed For Testing &#038; QA Community And What Lies Ahead

The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful