You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My use case is as follows: I want to watch a directory, which is a dropbox into which directories full of files and subdirs are atomically moved (FTP use case) - I want to be notified of these directories having been moved into the watched directory, so that I can process them.
The problem is that without hacking around the top-level API, the move events are converted from MOVED_TO to CREATED (similarly, MOVED_FROM gets turned into DELETED). Inotify itself reports these as expected, as seen from the debug logs, but then this bizarre conversion happens in InotifyEmitter.queue_events, from around line 156.
Specifically, this happens when events cross the watched boundary - in other words, moves within the watched directory are reported correctly, but moves to/from outside the watched directory get mangled.
This behavior is conditional on the full_events flag, but there is no documented way of setting this flag. From what I can see, the only solution is to manually bypass the Observer() helper function by reimplementing its functionality, e.g.:
defget_observer() ->watchdog.observers.api.BaseObserver:
"""Work around Watchdog's top-level API"""ifplatform.is_linux():
withcontextlib.suppress(UnsupportedLibcError):
fromwatchdog.observers.inotifyimportInotifyObserverreturnInotifyObserver(generate_full_events=True)
So I have two questions:
Is there a reasoning behind this behavior? I understand that some use cases are fine with it, but it would seem beneficial to not abstract away the distinction between a move and a create/delete.
Is there a reasoning for this not to be exposed in the API or docs?
The text was updated successfully, but these errors were encountered:
My quick and dirty analysis is that not all Observers support these semantics. Kqueue doesn't deal with the move destination, as I understand it, so this is a complete non-starter. Polling also would seem to not allow these events to be detected. The Windows API does seem to report moves across the watch boundary, but I haven't followed the code nor tested it myself - but it doesn't seem to be propagating them to the higher levels of the API.
My use case is as follows: I want to watch a directory, which is a dropbox into which directories full of files and subdirs are atomically moved (FTP use case) - I want to be notified of these directories having been moved into the watched directory, so that I can process them.
The problem is that without hacking around the top-level API, the move events are converted from
MOVED_TO
toCREATED
(similarly,MOVED_FROM
gets turned intoDELETED
). Inotify itself reports these as expected, as seen from the debug logs, but then this bizarre conversion happens inInotifyEmitter.queue_events
, from around line 156.Specifically, this happens when events cross the watched boundary - in other words, moves within the watched directory are reported correctly, but moves to/from outside the watched directory get mangled.
This behavior is conditional on the
full_events
flag, but there is no documented way of setting this flag. From what I can see, the only solution is to manually bypass theObserver()
helper function by reimplementing its functionality, e.g.:So I have two questions:
The text was updated successfully, but these errors were encountered: