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,
)
| 30 | |
| 31 | |
| 32 | def 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 | |
| 73 | def _checkpoint_one(collection, split_every) -> Delayed: |
searching dependent graphs…