I am using dask
to process files line by line. However, dask seems that do not do anything. My code logic is as follows:
import dask
from dask import delayed
from time import sleep
@dask.delayed
def inc(x):
sleep(1)
print(x)
def test():
for i in range(5):
delayed(inc)(i)
dask.compute(test())
However, no any outputs in console. Why?
Your function test
does not return anything.
Perhaps you meant to do something like
def test():
out = []
for i in range(5):
out.append(inc(i))
return out
(note that you already decorated inc
with delayed
, there is no need to call delayed(inc)
again)