dask 2021.10.0

Parameters
annotate(**annotations)

Annotations are metadata or soft constraints associated with tasks that dask schedulers may choose to respect: They signal intent without enforcing hard constraints. As such, they are primarily designed for use with the distributed scheduler.

Almost any object can serve as an annotation, but small Python objects are preferred, while large objects such as NumPy arrays are discouraged.

Callables supplied as an annotation should take a single key argument and produce the appropriate annotation. Individual task keys in the annotated collection are supplied to the callable.

Parameters

**annotations : key-value pairs

Context Manager for setting HighLevelGraph Layer annotations.

Examples

All tasks within array A should have priority 100 and be retried 3 times on failure.

This example is valid syntax, but we were not able to check execution
>>> import dask
... import dask.array as da
... with dask.annotate(priority=100, retries=3):
...  A = da.ones((10000, 10000))

Prioritise tasks within Array A on flattened block ID.

This example is valid syntax, but we were not able to check execution
>>> nblocks = (10, 10)
... with dask.annotate(priority=lambda k: k[1]*nblocks[1] + k[2]):
...  A = da.ones((1000, 1000), chunks=(100, 100))

Annotations may be nested.

This example is valid syntax, but we were not able to check execution
>>> with dask.annotate(priority=1):
...  with dask.annotate(retries=3):
...  A = da.ones((1000, 1000))
...  B = A + 1
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/base.py#47
type: <class 'function'>
Commit: