Skip to content

Refactor log_reports.py for Improved Logging, File Processing, and Slack Payload Handling#2249

Merged
qgallouedec merged 9 commits intohuggingface:mainfrom
Mefisto04:contribute
Oct 24, 2024
Merged

Refactor log_reports.py for Improved Logging, File Processing, and Slack Payload Handling#2249
qgallouedec merged 9 commits intohuggingface:mainfrom
Mefisto04:contribute

Conversation

@Mefisto04
Copy link
Copy Markdown
Contributor

This PR introduces several improvements to the log_reports.py script, including:

  1. Logging Enhancements:

    • Added a context-managed setup_logging function to configure logging with a more detailed format for better debugging.
  2. File Processing Refactor:

    • Created a new process_log_file function to encapsulate log file processing, reducing redundancy and improving error handling.
    • Enhanced error handling to include specific exceptions like FileNotFoundError and JSONDecodeError for more precise logging.
  3. Slack Payload Handling Improvements:

    • Refactored the Slack message preparation to improve readability and structure.
    • Included a fallback message when the total message length exceeds the maximum allowed.
  4. Code Cleanup:

    • Improved code readability by separating concerns and adding comments where necessary.
    • Ensured consistent log file cleanup with error handling for potential OSError cases.

These changes aim to make the script more maintainable, enhance logging detail, and improve the reliability of Slack notifications.

@Mefisto04
Copy link
Copy Markdown
Contributor Author

hey @qgallouedec , i have made a pr for this issue #2237 , please review all the changes that i have made.

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec
Copy link
Copy Markdown
Member

qgallouedec commented Oct 24, 2024

Thanks for helping improving this @Mefisto04. Can you make sure to run make precommit? A few suggestions, but it all looks good to me.

Mefisto04 and others added 3 commits October 25, 2024 00:00
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
@Mefisto04
Copy link
Copy Markdown
Contributor Author

hey @qgallouedec i have commits all the changes that you have provided, please review this

Copy link
Copy Markdown
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

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

Thanks again @Mefisto04

@qgallouedec qgallouedec merged commit 0de75b2 into huggingface:main Oct 24, 2024
yxliu-TAMU pushed a commit to mincheolseong/ECEN743-GRPO-Project-Proposal that referenced this pull request Apr 20, 2025
…d Slack Payload Handling (huggingface#2249)

* Update log_reports.py

* comments text update

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>

* emoji added

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>

* Update scripts/log_reports.py

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>

* Update scripts/log_reports.py

* style

* Update scripts/log_reports.py

---------

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>
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

Successfully merging this pull request may close these issues.

3 participants