John Muehlhausen
10/27/2021, 7:27 PM@task(log_stdout=True)
# ...
with Flow(..., executor=LocalDaskExecutor(scheduler="processes", num_workers=2)) as flow:
I see stdout when using the threads scheduler, but not with processes ... prefect version is 0.14.19 ... running flow locally in Jupyter at this point, no agent ... I should also mention that using the threads scheduler causes subsequent runs of the notebook cell to do nothing, but it is no surprise to me that threads would be less stable than subprocesses whose end state is cleaned up by the OSKevin Kho
John Muehlhausen
10/27/2021, 7:40 PMKevin Kho
John Muehlhausen
10/27/2021, 8:01 PMJohn Muehlhausen
10/27/2021, 8:04 PMKevin Kho
from dask.multiprocessing import get_context
from dask import delayed
import dask
context = get_context()
pool = context.Pool(4)
@delayed
def func():
print("test")
return 1
a = func()
b = func()
futures = [a,b]
dask.compute(futures, scheduler="processes", pool=pool)[0]
But if you do
a.compute()
you will see the stdout.
I’ll dig a bit to into that class to see if it’s fixableKevin Kho
dask.compute(futures, scheduler="processes")[0]
gives stdout but
dask.compute(futures, scheduler="threads")[0]
does.
Will dig a bit moreKevin Kho
Kevin Kho
compute
function source hereJohn Muehlhausen
10/27/2021, 8:17 PMKevin Kho
John Muehlhausen
10/27/2021, 8:17 PMJohn Muehlhausen
10/27/2021, 8:18 PMJohn Muehlhausen
10/27/2021, 8:18 PMJohn Muehlhausen
10/27/2021, 8:18 PMJohn Muehlhausen
10/27/2021, 8:19 PMKevin Kho
from dask.multiprocessing import get_context
from dask import delayed
import dask
if __name__ == "__main__":
context = get_context()
pool = context.Pool(4)
@delayed
def func():
print("test")
return 1
a = func()
b = func()
futures = [a,b]
dask.compute(futures, scheduler="processes", pool=pool)[0]
Kevin Kho
John Muehlhausen
10/27/2021, 8:22 PMKevin Kho
John Muehlhausen
10/27/2021, 8:23 PMJohn Muehlhausen
10/27/2021, 8:24 PM