15.2 Examples of Managing System Process
This section describes how to monitor and manage the resources used by
OML4Py Python user-defined functions (UDFs). It demonstrates how to retrieve the current
process, measure resource utilization before and after UDF execution, and use the
psutil library to configure resource limits for the current
process.
- Get Current Process and Limit Memory Usage
This example illustrates how you can use thepsutillibrary to retrieve the current Python process and apply a memory limit to it. - Measure Resources Before and After Running Your UDF
The example shows how to usepsutilto monitor the CPU and memory resources consumed by your user-defined function (UDF): - Controll Resources with psutil.RLIMIT_AS
The example illustrate how you can usepsutilto retrieve, set, and manage resource limits for the current process running your UDF. This helps in regulating memory consumption and ensuring stable execution.
Parent topic: Manage System Processes in OML4Py Using psutil