Skip to main content

Readers / writers file lock helper class

Project description

Readers / writers file lock Python helper class

Test PyPI Deployment

This library was created in order to ease the synchronization of several processes using shared resources, like a caching directory or a SQLite database. All of them can use the resources, but only one should update them.

The library is being used in several INB projects.

Example of a shared lock using context:

import datetime
import os
import time

from RWFileLock import RWFileLock

lock = RWFileLock("/tmp/rwfilelock.lock")
with lock.shared_lock():
    print(
        f"[{datetime.datetime.now().isoformat()}] Got shlock {os.getpid()}"
    )
	
    time.sleep(7)
    print(
        f"[{datetime.datetime.now().isoformat()}] Releasing shlock {os.getpid()}"
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RWFileLock-0.2.2.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

RWFileLock-0.2.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file RWFileLock-0.2.2.tar.gz.

File metadata

  • Download URL: RWFileLock-0.2.2.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for RWFileLock-0.2.2.tar.gz
Algorithm Hash digest
SHA256 41ec012d8edd1827d39553ce5cd9e59b04870f885ab1710da2b275e349a0ab66
MD5 60e8662d44fae8826369e773fd31230d
BLAKE2b-256 c4258324fc6725daafa04c06222217c5b7e8f5c97c77471a8d791f105716e1b2

See more details on using hashes here.

File details

Details for the file RWFileLock-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: RWFileLock-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for RWFileLock-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24d60c9192021c6fad19b5163849188bbc20df9e01a519f130431f60a5751c36
MD5 0552a115d9837324a17e94f47987513a
BLAKE2b-256 5f2bd1caae8b2de44b6cec5416e01cc3c6a09fa24263b02f7b0372e2dbed681c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page