I am confused as to why my dask program is not producing any output, it simply hangs after submitting. I have specified to use processes instead of threads and can see all of the cores fire up upon submitting (as suggested here:dask computation not executing in parallel) so it seems to compute but never finishes. I am just trying to run a simple regex over a list of long text files. Am I missing something obvious?
import re
from os import listdir
import dask.bag as db
import dask.multiprocessing
dask.set_options(get=dask.multiprocessing.get)
loc = 'D:\\...\\text_files\\'
txts = [loc + i for i in listdir(loc)[:10]]
# Load data in parallel
f = db.from_filenames(txts)
f = f.repartition(3)
# Define the regex
regex = re.compile(r'\b[A-Z][a-z]+\b')
# create function to parallelize
def reg(text):
return regex.findall(text)
# distribute the function over cores
output = f.map(reg).compute().concat()