Aug-03-2019, 07:58 PM
i was making sure subprocess.call (via Popen) can run commands in separate processes from subthreads so i can, at least, consider threads as a way to avoid having 2 processes per concurrent command. it still won't let me leave the last bunch of commands running, but for now this gets this project going (faster backups to AWS S3).
#!/usr/bin/env python3 import subprocess,threading m = 64 threads = [threading.Thread(target=subprocess.call,args=(['sleep',str(10000+x)],)) for x in range(1,m+1)] [threads[x].start() for x in range(m)] print(f'started {m} threads',flush=1) [threads[x].join() for x in range(m)] print(f'joined {m} threads',flush=1)
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.