Best Python code snippet using autotest_python
cpuset.py
Source:cpuset.py
...388 mems = nodes[-nodecnt:]389 create_container_with_specific_mems_cpus(name, mems, cpus)390 finally:391 my_unlock(lockfile)392def create_container_directly(name, mbytes, cpus):393 parent = os.path.dirname(name)394 if fake_numa_containers:395 _create_fake_numa_container_directly(name, parent, mbytes, cpus)396 else:397 create_container_via_memcg(name, parent, mbytes<<20, cpus)398def create_container_with_mbytes_and_specific_cpus(name, mbytes,399 cpus=None, root=SUPER_ROOT, io={}, move_in=True, timeout=0):400 """\401 Create a cpuset container and move job's current pid into it402 Allocate the list "cpus" of cpus to that container403 name = arbitrary string tag404 mbytes = reqested memory for job in megabytes405 cpus = list of cpu indicies to associate with the cpuset406 defaults to all cpus avail with given root407 root = the parent cpuset to nest this new set within408 '': unnested top-level container409 io = arguments for proportional IO containers410 move_in = True: Move current process into the new container now.411 timeout = must be 0: persist until explicitly deleted.412 """413 need_mem_containers()414 if not container_exists(root):415 raise error.AutotestError('Parent container "%s" does not exist'416 % root)417 if cpus is None:418 # default to biggest container we can make under root419 cpus = get_cpus(root)420 else:421 cpus = set(cpus) # interface uses list422 if not cpus:423 raise error.AutotestError('Creating container with no cpus')424 name = os.path.join(root, name) # path relative to super_root425 if os.path.exists(full_path(name)):426 raise error.AutotestError('Container %s already exists' % name)427 create_container_directly(name, mbytes, cpus)428 set_io_controls(name, **io)429 if move_in:430 move_self_into_container(name)431 return name432def get_boot_numa():433 # get boot-time numa=fake=xyz option for current boot434 # eg numa=fake=nnn, numa=fake=nnnM, or nothing435 label = 'numa=fake='436 for arg in utils.read_one_line('/proc/cmdline').split():437 if arg.startswith(label):438 return arg[len(label):]...
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!!