Navigation Menu

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

Improve harvester offline handling #164

Merged
merged 6 commits into from May 23, 2021
Merged

Conversation

pieterhelsen
Copy link
Collaborator

Split up the Windows and Linux/MacOS logic into separate consumers.

Added pygtail for Posix and Windows local consumers to enable better log rotation handling. Pygtail does add an artefact file (debug.log.offset) to the .chia/mainnet/log/ folder. This could potentially be moved to the chiadog folder if that's preferable.

Added retry to catch Pygtail errors and retry

Added has_rotated method for Windows Network consumer which reads log filesize over SSH using Powershell

Log output will look similar to this:
[2021-05-21 23:12:45] [ WARNING] --- [WinError 2] The system cannot find the file specified: 'C:\\Users\\PieterHelsen\\workspace\\debug.log', retrying in 2 seconds... (api.py:40)

Split up the Windows and Linux/MacOS logic into separate consumers.

Added `pygtail` to enable better log rotation handling. Pygtail does add an artefact file (`debug.log.offset`) to the `.chia/mainnet/log/` folder. This could potentially be moved to the chiadog folder if that's preferable.

Added `retry` to catch Pygtail errors and retry

Added `has_rotated` method which reads log filesize over SSH using Powershell
@martomi
Copy link
Owner

martomi commented May 22, 2021

@ajacobson pinging you here as that might require some changes to Docker. We still need read-only access to the log file itself, but docker should be able to write a file in that same folder (can be temporary, not synced with host machine).

https://github.com/ajacobson/chiadog-docker/blob/22db43bfee611d31a405b570278ac679dfa9e91a/docker-compose.yaml#L9

Edit: @pieterhelsen mentioned this file can be moved to chiadog folder. Maybe that'll be preferable for the docker setup?

Copy link
Owner

@martomi martomi left a comment

Choose a reason for hiding this comment

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

Great work 👍
I'll test the new Posix consumer today!

src/chia_log/log_consumer.py Outdated Show resolved Hide resolved
src/chia_log/log_consumer.py Show resolved Hide resolved
src/chia_log/log_consumer.py Outdated Show resolved Hide resolved
src/chia_log/log_consumer.py Outdated Show resolved Hide resolved
src/chia_log/log_consumer.py Show resolved Hide resolved
src/chia_log/log_consumer.py Outdated Show resolved Hide resolved
src/chia_log/log_consumer.py Outdated Show resolved Hide resolved
@martomi
Copy link
Owner

martomi commented May 22, 2021

Does this resolve #72 🤔

Changes made:
- Removed `paranoid` option from `Pygtail` - might not be required and requires considerable writes to disk. Should we still see 'harvester offline' false positives, this might be good to re-enable.

- Re-added remote SSH port support

- Miscellaneous cleanup
By default, Pygtail puts the offset file beside the file being tailed. The manual offset keeps this contained to the chiadog folder, which is better for (among others) the Docker container
@pieterhelsen
Copy link
Collaborator Author

@ajacobson pinging you here as that might require some changes to Docker. We still need read-only access to the log file itself, but docker should be able to write a file in that same folder (can be temporary, not synced with host machine).

https://github.com/ajacobson/chiadog-docker/blob/22db43bfee611d31a405b570278ac679dfa9e91a/docker-compose.yaml#L9

Edit: @pieterhelsen mentioned this file can be moved to chiadog folder. Maybe that'll be preferable for the docker setup?

Added the manual offset to write to within the chiadog root directory. Don't think there's any downsides and might be easier for Docker.

Does this resolve #72 🤔

I sure hope so!

@pieterhelsen
Copy link
Collaborator Author

This closes #134

@pieterhelsen pieterhelsen linked an issue May 22, 2021 that may be closed by this pull request
Copy link
Owner

@martomi martomi left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all feedback! Looking forward to see if this resolves the issues

@martomi martomi merged commit 9eb4a92 into dev May 23, 2021
@martomi martomi deleted the feature/improve-harvester-offline branch May 23, 2021 08:32
ajacobson added a commit to ajacobson/chiadog-docker that referenced this pull request May 25, 2021
jinnatar pushed a commit to jinnatar/chiadog that referenced this pull request Feb 5, 2023
* Add `pygtail` to enable better log rotation handling. It writes an artefact file (`debug.log.offset`) to the `chiadog` folder.
* Add `retry` to catch Pygtail errors and retry
* Add `has_rotated` method which reads log filesize over SSH using Powershell
* Removed `paranoid` option from `Pygtail` - might not be required and requires considerable writes to disk. Should we still see 'harvester offline' false positives, this might be good to re-enable.
* Remove OS-specific implementations of Local FileLogConsumer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants