Requested dask.distributed scheduler but no Client active


I create a dask client in a wrapper function and half of my code (which does not use delayed) executes well.
I create a delayed list with a function imported from another file. During the computation of this delayed list, I stumble on this error saying

RuntimeError: Requested dask.distributed scheduler but no Client active.

2023-12-11 19:48:51,921 - distributed.worker - WARNING - Compute Failed
Key:       dynamic_filter_by_keys-7808e6cc-6322-470b-a4c5-2a97e0bb8de4
Function:  execute_task
args:      ((<function apply at 0x7f0fc3016160>, <bound method OdDynamicFilter.dynamic_filter_by_keys of <automotive.evaluation_v2.od_components.od_dynamic_filter.OdDynamicFilter object at 0x7f0fa8b288b0>>, [], (<class 'dict'>, [['matches', '/home/mcw/AB/EVAL_V2/DEC/7/importance_whitelist/4w/static_filtered_matches-*.parquet'], ['dynamic_index', 1], ['value', (<class 'dict'>, [['column_name', 'score'], ['value', 1], ['operator', '>=']])]])))
kwargs:    {}
Exception: "RuntimeError('Requested dask.distributed scheduler but no Client active.')"

How should we pass the client object ? Can you please point me to any example OOPs code that makes use of Dask ?
Please let me know, Thanks.

I understand that we must call compute() through the dask.Client() object. Doing so solved this bug. :slight_smile:

Hi @thri5ha, welcome to Dask community!

It is not clear what was your problem, but anyway I’m glad you found a solution to it!