File: dill.rst

package info (click to toggle)
mpire 2.10.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,064 kB
  • sloc: python: 5,473; makefile: 209; javascript: 182
file content (30 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.. _use_dill:

Dill
====

.. contents:: Contents
    :depth: 2
    :local:

For some functions or tasks it can be useful to not rely on pickle, but on some more powerful serialization backends
like dill_. ``dill`` isn't installed by default. See :ref:`dilldep` for more information on installing the dependencies.

One specific example where ``dill`` shines is when using start method ``spawn`` (the default on Windows) in combination
with iPython or Jupyter notebooks. ``dill`` enables parallelizing more exotic objects like lambdas and functions defined
in iPython and Jupyter notebooks. For all benefits of ``dill``, please refer to the `dill documentation`_.

Once the dependencies have been installed, you can enable it using the ``use_dill`` flag:

.. code-block:: python

    with WorkerPool(n_jobs=4, use_dill=True) as pool:
        ...

.. note::

    When using ``dill`` it can potentially slow down processing. This is the cost of having a more reliable and
    powerful serialization backend.

.. _dill: https://pypi.org/project/dill/
.. _dill documentation: https://github.com/uqfoundation/dill