How to use the filelock.FileLockException function in filelock

To help you get started, we’ve selected a few filelock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / caravela / web / tasks.py View on Github external
def sync_dbs():

  # prevent multiple workers on the same box from
  # synching the directory at the same time
  lock_path = os.path.join(os.environ['DATA_DB_PATH'], 'tmp/db.lock')
  ensure_dir(lock_path)

  try:
    with FileLock(lock_path, wait=False):
      download_dbs()
  except FileLockException:
    logger.warn("Lockfile %s exists skiping sync",lock_path)

filelock

A platform independent file lock.

Unlicense
Latest version published 2 months ago

Package Health Score

94 / 100
Full package analysis