|
HWRF
trunk@4391
|
A class that waits for files to meet some requirements. More...
Public Member Functions | |
| def | __init__ |
| Constructor for the FileWaiter. More... | |
| def | add (self, flist) |
| Adds a file, or iterable that iterates over files, to the list of files to wait for. More... | |
| def | check |
| Checks to see if one file meets the requirements set in the constructor. More... | |
| def | reset (self) |
| Resets internal information about which files have been seen. More... | |
| def | iterfound (self) |
| Iterates over all files that were found. More... | |
| def | countfound (self) |
| Returns the number of files that were found. More... | |
| def | countmissing (self) |
| Returns the number of files that were NOT found. More... | |
| def | checkfiles |
| Looks for the requested files. More... | |
Public Attributes | |
| min_size | |
| The minimum file size. | |
| min_mtime_age | |
| Minimum age of the modification time. | |
| min_atime_age | |
| Minimum age of the access time. | |
| min_ctime_age | |
| Minimum age of the creation and/or inode access time. | |
| min_fraction | |
| The minimum fraction of files that must meet the requirements. | |
| def produtil.fileop.FileWaiter.__init__ | ( | self, | |
flist = None, |
|||
min_size = None, |
|||
min_mtime_age = None, |
|||
min_atime_age = None, |
|||
min_ctime_age = None, |
|||
min_fraction = 1.0 |
|||
| ) |
Constructor for the FileWaiter.
Most arguments have the same meaning as check_file()
| flist | the file or list of files to wait for. This is simply sent into self.add. |
| min_size | minimum file size |
| min_mtime_age | minimum modification time age, |
| min_atime_age | minimum access time age. |
| min_ctime_age | time since last file status change (see stat(2)) |
| min_fraction | the minimum fraction of the provided files that must match the above requirements in order for FileWaiter.wait to return True. Default is 1.0, which means all of them. |
| def produtil.fileop.FileWaiter.add | ( | self, | |
| flist | |||
| ) |
Adds a file, or iterable that iterates over files, to the list of files to wait for.
If the same filename is received a second time, it is ignored.
| flist | a filename (string) or list of filenames |
Definition at line 1079 of file fileop.py.
Referenced by produtil.fileop.FileWaiter.add().
| def produtil.fileop.FileWaiter.check | ( | self, | |
| filename, | |||
logger = None |
|||
| ) |
Checks to see if one file meets the requirements set in the constructor.
This default implementation calls check_file. This is in a separate member function so that a subclass can override the file checking method.
| filename | the path to the file to check |
| logger | a logging.Logger for messages |
Definition at line 1092 of file fileop.py.
Referenced by produtil.fileop.FileWaiter.checkfiles().
| def produtil.fileop.FileWaiter.checkfiles | ( | self, | |
maxwait = 1800, |
|||
sleeptime = 20, |
|||
logger = None, |
|||
log_each_file = True |
|||
| ) |
Looks for the requested files.
Will loop, checking over and over up to maxwait seconds, sleeping sleeptime seconds between checks.
| maxwait | maximum seconds to wait |
| sleeptime | sleep time in seconds between checks |
| logger | a logging.Logger for messages |
| log_each_file | log messages about each file checked |
Definition at line 1120 of file fileop.py.
Referenced by produtil.fileop.FileWaiter.countmissing().
| def produtil.fileop.FileWaiter.countfound | ( | self | ) |
| def produtil.fileop.FileWaiter.countmissing | ( | self | ) |
| def produtil.fileop.FileWaiter.iterfound | ( | self | ) |
| def produtil.fileop.FileWaiter.reset | ( | self | ) |
1.8.10