pydra.utils.profiler module

Utilities to keep track of performance and resource utilization.

class pydra.utils.profiler.ResourceMonitor(pid, interval=5, logdir=None, fname=None)[source]

Bases: Thread

A thread to monitor a specific PID with a certain frequency to a file.

property fname

Get/set the internal filename.


Core monitoring function, called by start().


Stop monitoring.

pydra.utils.profiler.get_max_resources_used(pid, mem_mb, num_threads, pyfunc=False)[source]

Get the RAM and threads utilized by a given process.

  • pid (integer) – the process ID of process to profile

  • mem_mb (float) – the high memory watermark so far during process execution (in MB)

  • num_threads (int) – the high thread watermark so far during process execution


  • mem_mb (float) – the new high memory watermark of process (MB)

  • num_threads (float) – the new high thread watermark of process


Get the total RAM of the running system, in GB.

pydra.utils.profiler.log_nodes_cb(node, status)[source]

Record node run statistics to a log file as json dictionaries.

  • node (nipype.pipeline.engine.Node) – the node being logged

  • status (string) – acceptable values are ‘start’, ‘end’; otherwise it is considered and error


this function does not return any values, it logs the node status info to the callback logger

Return type: