dask 2021.10.0

ParametersReturns
fuse_linear(dsk, keys=None, dependencies=None, rename_keys=True)

If specified, the keys in keys keyword argument are not fused. Supply dependencies from output of cull if available to avoid recomputing dependencies.

This function is mostly superseded by ``fuse``

Parameters

dsk: dict :
keys: list :
dependencies: dict, optional :

{key: [list-of-keys]}. Must be a list to provide count of each key This optional input often comes from cull

rename_keys: bool or func, optional :

Whether to rename fused keys with default_fused_linear_keys_renamer or not. Renaming fused keys can keep the graph more understandable and comprehensive, but it comes at the cost of additional processing. If False, then the top-most key will be used. For advanced usage, a func is also accepted, new_key = rename_keys(fused_key_list) .

Returns

dsk: output graph with keys fused
dependencies: dict mapping dependencies after fusion. Useful side effect

to accelerate other downstream optimizations.

Return new dask graph with linear sequence of tasks fused together.

Examples

This example is valid syntax, but we were not able to check execution
>>> d = {'a': 1, 'b': (inc, 'a'), 'c': (inc, 'b')}
... dsk, dependencies = fuse(d)
... dsk # doctest: +SKIP {'a-b-c': (inc, (inc, 1)), 'c': 'a-b-c'}
This example is valid syntax, but we were not able to check execution
>>> dsk, dependencies = fuse(d, rename_keys=False)
... dsk # doctest: +ELLIPSIS {'c': (<function inc at ...>, (<function inc at ...>, 1))}
This example is valid syntax, but we were not able to check execution
>>> dsk, dependencies = fuse(d, keys=['b'], rename_keys=False)
... dsk # doctest: +ELLIPSIS {'b': (<function inc at ...>, 1), 'c': (<function inc at ...>, 'b')}
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/optimization.py#80
type: <class 'function'>
Commit: