Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bangph/60fcd73692f767c94ce1280389443ac9 to your computer and use it in GitHub Desktop.
Save bangph/60fcd73692f767c94ce1280389443ac9 to your computer and use it in GitHub Desktop.
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