def determineChunking(filename, chunkSize): # chunkSize=0 signifies that the user wants to read the whole file if chunkSize == 0.: return [{}] # "small" files just get read in sizeGiB = os.path.getsize(filename) / 1024. / 1024. / 1024. if 6. * sizeGiB < chunkSize: return [{}] chunks = DetermineChunking(Filename=filename, MaxChunkSize=chunkSize, OutputWorkspace='chunks') strategy = [] for row in chunks: strategy.append(row) # For table with no rows if len(strategy) == 0: strategy.append({}) # delete chunks workspace chunks = str(chunks) # release the handle to the workspace object DeleteWorkspace(Workspace='chunks') return strategy
def determineChunking(filename, chunkSize): chunks = DetermineChunking(Filename=filename, MaxChunkSize=chunkSize, OutputWorkspace='chunks') strategy = [] for row in chunks: strategy.append(row) # For table with no rows if len(strategy) == 0: strategy.append({}) # delete chunks workspace chunks = str(chunks) DeleteWorkspace(Workspace='chunks') return strategy