helpers
resource_tracker.helpers
#
General helpers.
Functions:
Name | Description |
---|---|
is_partition |
Determine if a disk name represents a partition rather than a whole disk. |
is_psutil_available |
Check if psutil is installed and available for import. |
is_procfs_available |
Check if procfs is available on the system. |
get_tracker_implementation |
Determine which tracker implementation to use based on available system resources. |
get_zfs_pools_space |
Get the space of ZFS pools. |
cleanup_files |
Cleanup files. |
cleanup_processes |
Gracefully, then if needed forcefully terminate and close processes. |
is_partition
cached
#
Determine if a disk name represents a partition rather than a whole disk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
disk_name
|
str
|
Name of the disk device (e.g., 'sda1', 'nvme0n1p1') |
required |
Returns:s True if the device is likely a partition, False otherwise
Source code in resource_tracker/helpers.py
is_psutil_available
cached
#
Check if psutil is installed and available for import.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if psutil is available, False otherwise |
Source code in resource_tracker/helpers.py
is_procfs_available
cached
#
Check if procfs is available on the system.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if procfs is available, False otherwise |
get_tracker_implementation
cached
#
Determine which tracker implementation to use based on available system resources.
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple[Callable, Callable]
|
A tuple containing (get_pid_stats, get_system_stats) functions from the appropriate implementation module. |
Raises:
Type | Description |
---|---|
ImportError
|
If no suitable implementation is available. |
Source code in resource_tracker/helpers.py
get_zfs_pools_space
#
Get the space of ZFS pools.
Source code in resource_tracker/helpers.py
cleanup_files
#
cleanup_processes
#
Gracefully, then if needed forcefully terminate and close processes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processes
|
List[Process]
|
List of |
required |