Created
March 23, 2018 08:19
-
-
Save albertyw/fb79f633a6f6991b620334ded1ce7dd2 to your computer and use it in GitHub Desktop.
Revisions
-
albertyw created this gist
Mar 23, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ import subprocess import time commands = ['./time.sh'] * 5 outputs = [None] * len(commands) processes = [None] * len(commands) start = time.time() for i, command in enumerate(commands): process = subprocess.Popen([command], stdout=subprocess.PIPE) processes[i] = process for i, process in enumerate(processes): outputs[i] = process.communicate() print(i, outputs[i]) print('elapsed seconds: ', time.time() - start) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ #!/bin/bash sleep 2 date