MCPcopy
hub / github.com/dask/dask / checkpoint

Function checkpoint

dask/graph_manipulation.py:32–70  ·  view source on GitHub ↗

Build a :doc:`delayed` which waits until all chunks of the input collection(s) have been computed before returning None. Parameters ---------- collections Zero or more Dask collections or nested data structures containing zero or more collections split_every: int

(
    *collections,
    split_every: float | Literal[False] | None = None,
)

Source from the content-addressed store, hash-verified

30
31
32def checkpoint(
33 *collections,
34 split_every: float | Literal[False] | None = None,
35) -> Delayed:
36 """Build a :doc:`delayed` which waits until all chunks of the input collection(s)
37 have been computed before returning None.
38
39 Parameters
40 ----------
41 collections
42 Zero or more Dask collections or nested data structures containing zero or more
43 collections
44 split_every: int >= 2 or False, optional
45 Determines the depth of the recursive aggregation. If greater than the number of
46 input keys, the aggregation will be performed in multiple steps; the depth of
47 the aggregation graph will be :math:`\\log_\\text{split_every}(\\text{input keys})`.
48 Setting to a low value can reduce cache size and network transfers, at the cost
49 of more CPU and a larger dask graph.
50
51 Set to False to disable. Defaults to 8.
52
53 Returns
54 -------
55 :doc:`delayed` yielding None
56 """
57 if split_every is None:
58 split_every = 8
59 elif split_every is not False:
60 split_every = int(split_every)
61 if split_every < 2:
62 raise ValueError("split_every must be False, None, or >= 2")
63
64 collections, _ = unpack_collections(*collections)
65 if len(collections) == 1:
66 return _checkpoint_one(collections[0], split_every)
67 else:
68 return delayed(chunks.checkpoint)(
69 *(_checkpoint_one(c, split_every) for c in collections)
70 )
71
72
73def _checkpoint_one(collection, split_every) -> Delayed:

Callers 6

test_checkpointFunction · 0.90
test_split_everyFunction · 0.90
test_split_every_invalidFunction · 0.90
bindFunction · 0.85
wait_onFunction · 0.85

Calls 3

unpack_collectionsFunction · 0.90
delayedFunction · 0.90
_checkpoint_oneFunction · 0.85

Tested by 4

test_checkpointFunction · 0.72
test_split_everyFunction · 0.72
test_split_every_invalidFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…