# Process monitoring


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Process snapshots

------------------------------------------------------------------------

<a
href="https://github.com/sayanbanerjee32/snooper_pkg/blob/main/snooper_pkg/process_monitor.py#L25"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_current_processes

``` python
def get_current_processes(
    excluded_process_set
):
```

*Return running `(pid, process_name)` pairs excluding configured
processes.*

## Process event monitoring

------------------------------------------------------------------------

<a
href="https://github.com/sayanbanerjee32/snooper_pkg/blob/main/snooper_pkg/process_monitor.py#L31"
target="_blank" style="float:right; font-size:smaller">source</a>

### start_process_monitoring

``` python
def start_process_monitoring(
    session_id, stop_event, excluded_processes, time_interval:int=5
):
```

*Poll processes until stopped and log process start and stop events.*

- [`get_current_processes`](https://sayanbanerjee32.github.io/snooper_pkg/process_monitor.html#get_current_processes)
  assumes the values returned by `proc.info` retain the requested
  `['pid', 'name']` order. Confirm this is an intentional `psutil` usage
  assumption.
- The module logs process events and prints changes, but does not
  document or handle process-access exceptions such as permissions
  errors. Confirm whether those cases are handled elsewhere or should be
  addressed after the nbdev migration.
