def check_data_valid(data, startval, endval=None):
if endval is None:
endval = len(data)
chunksize = 10000000
startval = int(startval)
endval = int(endval)
offsets = np.arange(0, len(data), chunksize)
args = []
result = True
for offset in offsets:
s = startval + offset
e = min(s + chunksize, endval)
nelems = e - s
test_chunk = data[offset:offset + nelems]
args.append((s, e, test_chunk))
pool = mp.Pool()
result = all(pool.map(_check_chunk, args))
pool.terminate()
return result
评论列表
文章目录