I am trying to write a python **daemon**
which will run **multiple shell scripts** at a **same time** on some conditions
and do something on **each task finish**

```
import time
import schedule
import subprocess

def spawn(name, count):
    cmd = 'some long lived shell process'
    proc = subprocess.Popen(cmd, shell=True, stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL, close_fds=True)
    consumers_dictionary[name] = proc

def thread_task():
    if someconditions
        spawn(name, count)

consumers_dictionary = {}
schedule.every(1).seconds.do(thread_task)
while 1:
    schedule.run_pending()
    time.sleep(1)

```

How can I control proc status and do something when process is finished?
Think I need something like promises, or check each my dictionary proc object on status?

P.S. Daemon should be able to work(run and track status) with up to 500 processes