Skip to content

process_monitoring_probe

qoa4ml.probes.process_monitoring_probe

Classes

ProcessMonitoringProbe

ProcessMonitoringProbe is responsible for monitoring system processes and creating reports based on usage statistics.

Parameters:

Name Type Description Default
config
ProcessProbeConfig

Configuration settings for the process monitoring probe.

required
connector
BaseConnector

Connector to send the report data.

required
client_info
Optional[ClientInfo]

Information about the client, default is None.

None

Attributes:

Name Type Description
config ProcessProbeConfig

The process monitoring probe configuration.

pid int

The process ID to monitor.

environment EnvironmentEnum

The environment in which the process is running.

process Process

The psutil Process object for the monitored process.

obs_service_url Optional[str]

The URL of the observation service, if registration is required.

metadata Union[dict, ProcessMetadata]

Metadata related to the monitored process.

Methods:

Name Description
get_cpu_usage

Get the CPU usage of the process.

get_mem_usage

Get the memory usage of the process.

create_report

Create a JSON report based on the process statistics.

Functions
__init__(config, connector, client_info=None)

Initialize an instance of ProcessMonitoringProbe.

Parameters:

Name Type Description Default
config ProcessProbeConfig

Configuration settings for the process monitoring probe.

required
connector BaseConnector

Connector to send the report data.

required
client_info Optional[ClientInfo]

Information about the client, default is None.

None
create_report()

Create a JSON report based on the process statistics.

Returns:

Type Description
str

JSON-encoded report containing process statistics.

Notes
  • This method collects CPU and memory usage stats for the specified process.
  • Reports are generated differently based on the environment (HPC or other).
get_cpu_usage()

Get the CPU usage of the process.

Returns:

Type Description
dict

Dictionary containing the CPU usage information.

get_mem_usage()

Get the memory usage of the process.

Returns:

Type Description
dict

Dictionary containing the memory usage in megabytes.

Functions