Reputation: 715
Am building a custom graph for one operation with Dask. Am familiar with how to pass arguments to a function in Dask graph and have read up on the docs. However still seem to be missing something.
One of the functions used in the Dask graph takes keyword arguments. Though am confused as to how the keyword arguments can be passed to it. Some of these keyword arguments represent Dask objects so they must be in the graph explicitly (i.e. functools.partial
won't work). Can see the following options.
**kwargs
or keyword only arguments)Any thoughts on how best to do this?
Upvotes: 4
Views: 688
Reputation: 57281
A common workaround is to use the apply
function
from dask.utils import apply
task = (apply, func, args, kwargs) # func(*args, **kwargs)
Upvotes: 1
Reputation: 131
The answer by @MRocklin should be edited to conform to newer dask versions:
from dask.utils import apply
task = (apply, func, args, kwargs) # func(*args, **kwargs)
Upvotes: 0