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

Method persist

dask/base.py:307–347  ·  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

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

Callers 2

persistFunction · 0.45

Calls 1

persistFunction · 0.85

Tested by

no test coverage detected