0
for n in filepath_fetch:
        filepath_ = n[0]
        p2 = subprocess.Popen(["python",script_path ,str(filepath_) ,str(type_id) , str(returned_id) ],timeout=30)
    p2.wait()

I have processes on the server that never die. I changed the above as below. Is it true?

for n in filepath_fetch:
        filepath_ = n[0]
        p2 = subprocess.Popen(["python",script_path ,str(filepath_) ,str(type_id) , str(returned_id) ],timeout=30)
    try:
        p2.wait()
    except subprocess.TimeoutExpired:
        p2.kill()

I expect processes to close on the server after a certain period of time. At the same time, the cycle must not pause.

Arda G
  • 1

0 Answers0