resmon Module

Resource monitor.

wpull.resmon.ResourceInfo

Resource level information

wpull.resmon.path

str, None

File path of the resource. None is provided for memory usage.

wpull.resmon.free

int

Number of bytes available.

wpull.resmon.limit

int

Minimum bytes of the resource.

alias of ResourceInfoType

class wpull.resmon.ResourceMonitor(resource_paths=('/', ), min_disk=10000, min_memory=10000)[source]

Bases: object

Monitor available resources such as disk space and memory.

Parameters:
  • resource_paths (list) – List of paths to monitor. Recommended paths include temporary directories and the current working directory.
  • min_disk (int, optional) – Minimum disk space in bytes.
  • min_memory (int, optional) – Minimum memory in bytes.
check()[source]

Check resource levels.

Returns:If None is provided, no levels are exceeded. Otherwise, the first ResourceInfo exceeding limits is returned.
Return type:None, ResourceInfo
get_info()[source]

Return ResourceInfo instances.