Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | List of all members
torch.utils.file_baton.FileBaton Class Reference

Public Member Functions

def __init__ (self, lock_file_path, wait_seconds=0.1)
 
def try_acquire (self)
 
def wait (self)
 
def release (self)
 

Public Attributes

 lock_file_path
 
 wait_seconds
 
 fd
 

Detailed Description

A primitive, file-based synchronization utility.

Definition at line 12 of file file_baton.py.

Constructor & Destructor Documentation

def torch.utils.file_baton.FileBaton.__init__ (   self,
  lock_file_path,
  wait_seconds = 0.1 
)
Creates a new :class:`FileBaton`.

Args:
    lock_file_path: The path to the file used for locking.
    wait_seconds: The seconds to periorically sleep (spin) when
calling ``wait()``.

Definition at line 15 of file file_baton.py.

Member Function Documentation

def torch.utils.file_baton.FileBaton.release (   self)
Releaes the baton and removes its file.

Definition at line 51 of file file_baton.py.

def torch.utils.file_baton.FileBaton.try_acquire (   self)
Tries to atomically create a file under exclusive access.

Returns:
    True if the file could be created, else False.

Definition at line 28 of file file_baton.py.

def torch.utils.file_baton.FileBaton.wait (   self)
Periodically sleeps for a certain amount until the baton is released.

The amount of time slept depends on the ``wait_seconds`` parameter
passed to the constructor.

Definition at line 41 of file file_baton.py.


The documentation for this class was generated from the following file: