0

I have two scripts, they are both multiprocessing utilized scripts.

build.py reads from a db and spits out a text file. Parallel jobs are launched to do this.

push.py inserts/updates this text file to a persistent DB. Again, this is multiprocessing too.

Currently I have two separate crontab commands to do this. I want build.py to launch push.py then terminate itself, how can I do this?

1 Answer 1

1

You can just use subprocess

In build.py

import subprocess

def main():
    # Do multiprocessing code, wait for all processes to finish
    ...

    # Launch push.py and exit
    subprocess.Popen(['python', '/path/to/push.py'])

if __name__ == '__main__':
    main()
Sign up to request clarification or add additional context in comments.

1 Comment

Also temporary congrats on being the first to earn the Bluebook badge!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.