How to use the filelock.PID_WARN 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 nlplab / brat / server / src / backup.py View on Github external
def backup(min_interval=MIN_INTERVAL, backup_dir=BACKUP_DIR, data_dir=DATA_DIR):
    if backup_dir is None:
        return

    #XXX: The timeout is arbitrary but dependent on the back-up, should we start
    #       with a sane default and then refer to how long the last back-up
    #       took?  
    backup_lock = join_path(DATA_DIR, '.backup.lock')
    with file_lock(backup_lock, pid_policy=PID_WARN, timeout=60):
        _backup(min_interval, backup_dir, data_dir)

filelock

A platform independent file lock.

Unlicense
Latest version published 3 months ago

Package Health Score

94 / 100
Full package analysis