pyufunc.safe_write_pickle_with_lock#
- pyufunc.safe_write_pickle_with_lock(path, data, *, lock_path=None, timeout=-1, protocol=5)#
Write pickle data while holding a file lock.
- Parameters:
path – Destination file path.
data – Object to pickle.
lock_path – Optional lock-file path. Defaults to
pathplus.lock.timeout – Maximum seconds to wait for the lock.
protocol – Pickle protocol version.
Note
Source package:
filelock.Source repository: tox-dev/py-filelock
Source document: https://py-filelock.readthedocs.io
Source license: MIT License.
Example
>>> safe_write_pickle_with_lock("data.pkl", {"ok": True})
- Returns:
The destination path.
- Return type:
Path