This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
catfish/catfish/worker/__init__.py
2018-12-12 16:52:37 +00:00

23 lines
370 B
Python

import time
import os
import tempfile
import psutil
PID_FILE = os.path.join(tempfile.gettempdir(), "catfish.pid")
def is_running():
return os.path.exists(PID_FILE)
def get_running_process() -> psutil.Process:
assert is_running()
with open(PID_FILE) as f:
return psutil.Process(int(f.read()))
def main():
while True:
time.sleep(1)