MCPcopy Create free account
hub / github.com/dask/dask / persist

Method persist

dask/base.py:326–366  ·  view source on GitHub ↗

Persist this dask collection into memory This turns a lazy Dask collection into a Dask collection with the same metadata, but now with the results fully computed or actively computing in the background. The action of function differs significantly depending on the a

(self, **kwargs)

Source from the content-addressed store, hash-verified

324 )
325
326 def persist(self, **kwargs):
327 """Persist this dask collection into memory
328
329 This turns a lazy Dask collection into a Dask collection with the same
330 metadata, but now with the results fully computed or actively computing
331 in the background.
332
333 The action of function differs significantly depending on the active
334 task scheduler. If the task scheduler supports asynchronous computing,
335 such as is the case of the dask.distributed scheduler, then persist
336 will return *immediately* and the return value's task graph will
337 contain Dask Future objects. However if the task scheduler only
338 supports blocking computation then the call to persist will *block*
339 and the return value's task graph will contain concrete Python results.
340
341 This function is particularly useful when using distributed systems,
342 because the results will be kept in distributed memory, rather than
343 returned to the local process as with compute.
344
345 Parameters
346 ----------
347 scheduler : string, optional
348 Which scheduler to use like "threads", "synchronous" or "processes".
349 If not provided, the default is to check the global settings first,
350 and then fall back to the collection defaults.
351 optimize_graph : bool, optional
352 If True [default], the graph is optimized before computation.
353 Otherwise the graph is run as is. This can be useful for debugging.
354 **kwargs
355 Extra keywords to forward to the scheduler function.
356
357 Returns
358 -------
359 New dask collections backed by in-memory data
360
361 See Also
362 --------
363 dask.persist
364 """
365 (result,) = persist(self, traverse=False, **kwargs)
366 return result
367
368 def compute(self, **kwargs):
369 """Compute this dask collection

Callers 2

persistFunction · 0.45

Calls 1

persistFunction · 0.85

Tested by

no test coverage detected