Supervisor starts a python program with a mulitprocess module, and the main process is blocked by its child processes

problem description

use supervisor to start a Python program with a mulitprocess module, the program will generate a child process to execute tasks, but the main process calling the mulitprocess will be blocked by the child process, if the program is not executed directly through the supervisor, the main process will not be blocked by the child process, what is the reason for this?

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< H1 >! / usr/bin/python < / H1 >

from multiprocessing import Pool
import subprocess
import os
import time

def task01 ():

time.sleep(30)
print "task01 start running"
with open("/opt/task_play_01.log", "a") as f:
    f.write("task01 start running\n")
    f.write("task01 finished\n")

def main ():

print "start spawn child"
task_executor = Process(target=task01)
print "child process is ready"
task_executor.start()
print "wait for executor finished"

if name ="_ _ main__":

main()

what result do you expect? What is the error message actually seen?

the result of running the above script directly is:
start spawn child
child process is ready
wait for executor finished
task01 start running

the result of starting the above script via supervisor is
start spawn child
child process is ready
task01 start running
wait for executor finished

Mar.11,2022
Menu