Latest recipes tagged "watch"http://code.activestate.com/recipes/tags/watch/new/2014-05-30T01:10:53-07:00ActiveState Code RecipesMonitor Progress of File Descriptors of Another Process (Python)
2014-05-30T01:10:53-07:00Alfehttp://code.activestate.com/recipes/users/4182236/http://code.activestate.com/recipes/578882-monitor-progress-of-file-descriptors-of-another-pr/
<p style="color: grey">
Python
recipe 578882
by <a href="/recipes/users/4182236/">Alfe</a>
(<a href="/recipes/tags/file_descriptor/">file_descriptor</a>, <a href="/recipes/tags/monitor/">monitor</a>, <a href="/recipes/tags/prediction/">prediction</a>, <a href="/recipes/tags/proc/">proc</a>, <a href="/recipes/tags/process/">process</a>, <a href="/recipes/tags/progress/">progress</a>, <a href="/recipes/tags/watch/">watch</a>).
</p>
<p>This tool (inspired by azat@stackoverflow, see <a href="http://stackoverflow.com/a/16082562/1281485" rel="nofollow">http://stackoverflow.com/a/16082562/1281485</a>) allows to watch the progress of the file descriptors of another process. This can be used, for example, if you transfer a file to another host and the transferring program does not show any progress indication itself. Instead of waiting blindly until the routine is done, with this tool you can use Linux's proc file system to monitor the progress of the other process while it walks through the file.</p>
<p>The tool continuously monitors the position in and the size of the files the given process's file descriptors point to. For growing (or shrinking, but that's very unusual) files, a time when it was (or will be) empty is computed ("emptyTime"), for moving file descriptors (the typical case), the time when it started at position 0 ("startTime"), the time when it will reach the current size of the file ("reachTime") and when it will meet with the end of a growing (or shrinking) file is computed ("meetTime").</p>
<p>For fixed-size files the meetTime will be the same as the reachTime of course. The meetTime only makes sense in case a file is growing and at the same time read (e. g. when a movie is downloaded to a file by one process and converted by a different process; using this tool can tell you when the converter process might run dry on the input because the download wasn't fast enough, and in this case you maybe can pause the converter to prevent this situation).</p>
<p>The tool is designed as a library; the display of the information is independent from the gathering of the data. Please feel free to create more fancy displays, add percentage output etc.</p>
Watch directory and do periodic commits to Subversion repository. (Python)
2011-02-10T14:00:13-08:00Jiri Zahradilhttp://code.activestate.com/recipes/users/4170037/http://code.activestate.com/recipes/577570-watch-directory-and-do-periodic-commits-to-subvers/
<p style="color: grey">
Python
recipe 577570
by <a href="/recipes/users/4170037/">Jiri Zahradil</a>
(<a href="/recipes/tags/subversion/">subversion</a>, <a href="/recipes/tags/watch/">watch</a>).
</p>
<p>You run this script with directory as parameter (defaults to current directory) and scripts watch this directory for changes in files - creating new file, deleting some file and modification to any file. All these changes are periodically commited to subversion repository using external commands.</p>
<p>Not especially good for coding but great for tracking changes in your text files f.e. during essay writing etc.</p>