Using Parent and Children scripts to execute code in parallel

suggest change
# name: parent.py
import os

def main():
    for i in range(5):
        os.system("python child.py &")  # Unix shell: & runs the child in the background

if __name__ == '__main__':
    main()

This is useful for parallel, independent HTTP request/response tasks or Database select/inserts. Command line arguments can be given to the child.py script as well. Synchronization between scripts can be achieved by all scripts regularly checking a separate server (like a Redis instance).

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents