Did I find the right examples for you? yes no

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)
File-based lock mechanism used for preventing concurrency problems 

src/c/o/confine-controller-0.10.5/controller/apps/state/tasks.py   confine-controller(Download)
from django.db.models import get_model
 
from controller.utils import LockFile
 
from .settings import STATE_LOCK_DIR, STATE_SCHEDULE
    freq = STATE_SCHEDULE
    # Prevent concurrent executions
    with LockFile(lock_file, expire=freq-(freq*0.2), unlocked=not lock):
        model = get_model(*state_module.split('.'))
        objects = model.objects.all()

src/c/o/confine-controller-0.10.5/controller/apps/pings/tasks.py   confine-controller(Download)
from django.utils import timezone
 
from controller.utils import LockFile
from controller.utils.apps import is_installed
from controller.utils.time import group_by_interval, get_sloted_start
 
    # Prevent concurrent executions
    with LockFile(lock_file, expire=freq-(freq*0.2), unlocked=not lock):
        objects = model.objects.all()
        filter = settings.get('filter', False)

src/c/o/confine-controller-0.10.5/controller/apps/mgmtnetworks/tinc/tasks.py   confine-controller(Download)
from celery.task import task
 
from controller.utils import LockFile
from controller.utils.system import run, touch
 
 
    # File-based lock mechanism to prevent concurrency problems
    with LockFile(hosts_path+'.lock', expire=60):
        clients = TincClient.objects.all()
        gateways = TincServer.objects.gateways()