I have a large csv file that I split into a list of chunks of 100000 rows each, pass each chunk to a function to do complex calculations, and append the result in a global_list. when the last chunk is finished, i take the global_list and do some statistic on. How can i ask celery to process all chunks in parallel but to wait until last task/last chunk is finished before executing the function complex_calc on the global_list?
Thank you for your help
for chunk in global_chunk_list:
def func_calc.delay(chunk) #<<<<< use celery tasks
complex_calc(global_list) #<<<<< should only start when processing last chunk is finished
@celery.task(name='func_calc')
def func_calc(chunk):
...
#save chunk in a global list
global_list.append(result)
def complex_calc(global_list):
...