Created
February 5, 2020 14:51
-
-
Save bangph/60fcd73692f767c94ce1280389443ac9 to your computer and use it in GitHub Desktop.
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 characters
from multiprocessing import Process | |
import os | |
import time | |
import glob | |
def task(): | |
query_files = glob.glob("/home/rasdaman/rasdaman_community/rasdaman/systemtest/testcases_mandatory/test_select/queries/condense_*.rasql") | |
for query_file in query_files: | |
with open(query_file, 'r') as file: | |
query = file.read() | |
print "Querying file " + query_file | |
command = "rasql -q '" + query + "' >> /dev/null" | |
os.system(command) | |
print "Task is done. \n" | |
time.sleep(10) | |
tasks = [] | |
max_processes = 5 | |
# Run this task with max times | |
for i in range(0, max_processes): | |
tasks.append(task) | |
all_processes = [] | |
for func in tasks: | |
p = Process(target = func) | |
all_processes.append(p) | |
p.start() | |
for p in all_processes: | |
p.join() | |
print "All threads finished." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment