Skip to content

filelock

etl_craft.core.filelock

An exclusive lock held on a file, shared by every process on the machine.

The operating system releases the lock when its holder exits, even when it is killed, so a crashed process never leaves a stale lock behind.

file_lock

file_lock(path: str | Path, wait_seconds: float = 0) -> Iterator[None]

Hold an exclusive lock on path, creating the file if needed, for the with body.

Waits for another holder to release it: indefinitely when wait_seconds is 0, otherwise raising LockTimeoutError once wait_seconds have passed.