4.5. sciexp2.exprun.process

Source: sciexp2/exprun/process.py

Process management functions.

Functions

cgroup_create Create a cgroup for given subsystem.
cgroup_move Move pids to a cgroup.
cgroup_pids Get pids in given cgroup path.
get_tids Get ids of all threads in a given process.
pin Pin pid to given physical CPU list.

4.5.1. cgroup_create

cgroup_create(shell, controller, path, **kwargs)

Create a cgroup for given subsystem.

Parameters:
shell

Target shell.

controller : str

Cgroup controller to configure.

path : str

New cgroup path.

kwargs : dict

Controller parameters to set. Lists are comma-concatenated, all elements are transformed to str.

4.5.2. cgroup_move

cgroup_move(shell, controller, path, pids)

Move pids to a cgroup.

Parameters:
shell

Target shell.

controller : str

Cgroup controller.

path : str

Cgroup path.

pids : pid or list of pid

Pids to move into the cgroup. All elements are transformed to str.

Notes

If you move the process that is serving this shell, you might have to reconnect the shell to continue using it.

4.5.3. cgroup_pids

cgroup_pids(shell, path=None)

Get pids in given cgroup path.

Parameters:
shell

Target shell.

path : str, optional

Cgroup path to analyze (defaults to entire system).

Returns:
list of int

Pids in the given cgroup.

4.5.4. get_tids

get_tids(shell, pid, filter=None)

Get ids of all threads in a given process.

Parameters:
shell

Target shell.

pid : int

Target process pid.

filter : str or cre, optional

Return pids that match given filter in process name. Default is all pids.

Returns:
list of int

List of the selected process pids.

Notes

When using a string for filter it will simply check it is part of the process name.

4.5.5. pin

pin(shell, pid, cpus, **shell_kwargs)

Pin pid to given physical CPU list.

Parameters:
shell

Target shell.

pid : int

Target pid or tid to pin.

cpus : list of int

Physical CPUs to pin the pid to.

shell_kwargs : optional

Arguments to shell.run