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

Change FileWatcher to stop printing watchfiles debug log #340

Conversation

ela-kotulska-frequenz
Copy link
Contributor

@ela-kotulska-frequenz ela-kotulska-frequenz commented Nov 21, 2024

The underlying Rust code performs periodic checks to see
if it should stop watching. These checks raise TimeoutError,
which by default would log misleading debug messages.
The debug log was printed every 5 sec on linux.
Setting yield_on_timeout=True makes it yield an empty
set instead of printing debug logs.
We handle these empty sets in the ready() method by
continuing to wait.

@ela-kotulska-frequenz ela-kotulska-frequenz added the priority:low This should be addressed only if there is nothing else on the table label Nov 21, 2024
@ela-kotulska-frequenz ela-kotulska-frequenz self-assigned this Nov 21, 2024
@ela-kotulska-frequenz ela-kotulska-frequenz requested a review from a team as a code owner November 21, 2024 11:01
@ela-kotulska-frequenz ela-kotulska-frequenz added the cmd:skip-release-notes It is not necessary to update release notes for this PR label Nov 21, 2024
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:utilities Affects the utility receivers (`Timer`, `Event`, `FileWatcher`) labels Nov 21, 2024
@ela-kotulska-frequenz
Copy link
Contributor Author

If we use or plan to use any Windows system, then this PR won't work.

# Two arguments below are ok for non-Windows systems.
# For more details, refer awatch documentation.
rust_timeout=sys.maxsize - 1,
yield_on_timeout=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what the impact of this would be on windows systems?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@ela-kotulska-frequenz ela-kotulska-frequenz Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think that if we change rust_timeout=sys.maxsize - 1, back to None.
Then it should work on Windows and won't print debug log. However I didn't test it.

This is because the timeout mechanism in awatch looks like this:

            if raw_changes == 'timeout':
                if yield_on_timeout:
                    yield set()
                else:
                    logger.debug('rust notify timeout, continuing')

So instead of printing debug log, it can yield set() and we can ignore it.
Only then debug logs won't print if it awatch was killed or not.

@shsms
Copy link
Contributor

shsms commented Nov 21, 2024

If we use or plan to use any Windows system, then this PR won't work.

We will also have to support Windows machines because there are existing users.

@ela-kotulska-frequenz ela-kotulska-frequenz changed the title Change FileWatcher to ignore watchfile heartbeat timeout. Change FileWatcher to stop printing watchfiles debug log Nov 21, 2024
@llucax
Copy link
Contributor

llucax commented Nov 21, 2024

Isn't there any way to control DEBUG logging in watchfiles? For me that would be the best choice, this is just a DEBUG message!

The underlying Rust code performs periodic checks to see
if it should stop watching. These checks raise TimeoutError,
which by default would log misleading debug messages.
Setting yield_on_timeout=True makes it yield an empty
set instead of printing debug logs.
We handle these empty sets in the `ready()` method by
continuing to wait.
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think we shouldn't go for this, we just need to disable the DEBUG logging if we have DEBUG logging enabled but find these particular messages too annoying and unhelpful.

@ela-kotulska-frequenz
Copy link
Contributor Author

We decided to abort this PR and handle it higher level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd:skip-release-notes It is not necessary to update release notes for this PR part:tests Affects the unit, integration and performance (benchmarks) tests part:utilities Affects the utility receivers (`Timer`, `Event`, `FileWatcher`) priority:low This should be addressed only if there is nothing else on the table
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants