Check if this process is a worker spawned by uwsgi/gunicorn.
()
| 9 | |
| 10 | |
| 11 | def _is_worker_process(): |
| 12 | """Check if this process is a worker spawned by uwsgi/gunicorn.""" |
| 13 | try: |
| 14 | parent = psutil.Process(os.getppid()) |
| 15 | parent_name = parent.name() |
| 16 | return parent_name in ['uwsgi', 'gunicorn'] |
| 17 | except Exception: |
| 18 | # If we can't determine, assume it's not a worker (safe default) |
| 19 | return False |
| 20 | |
| 21 | |
| 22 | def should_skip_initialization(): |
no outgoing calls
no test coverage detected