Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inotify not available on MacOS #14

Open
dusty-phillips opened this issue Jul 30, 2021 · 0 comments
Open

inotify not available on MacOS #14

dusty-phillips opened this issue Jul 30, 2021 · 0 comments

Comments

@dusty-phillips
Copy link

Split out from discussion in #4 which is specific to polling the subprocesses to summarize my research so far.

The inotify events used in Filesystem are not supported on MacOS. Instead, we would need to use either a polling mechanism (os.scandir isn't "slow", but it's probably enough milliseconds to defeat Assay's emphasis on speed) or the C-level MacOS FSEvent polling mechanism.

There are third-party wrappers of FSEvent in Python, all of which include some sort of C extension, and most of which provide an abstraction over cross-platform filesystem monitoring. The most-supported one appears to be watchdog.

FSEvent uses a callback based approach to process events instead of returning a file descriptor that can be selected on by kqueue the way inotify does with epoll. This means that listening for fsevent changes will be fundamentally different from the other events that are happening in the monitor's main loop. (This leads me to wonder whether to refactor to let asyncio control the loop).

As an aside, one other place I noticed incorrect behaviour under macos is in unix.cpu_count() because /proc is a Linux-only thing. Perhaps it could be replaced with multiprocessing.cpu_count()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant