Skip to content

When runs fail, save and report run failure to Slack #729

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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

e-belfer
Copy link
Member

@e-belfer e-belfer commented Jul 8, 2025

Overview

Closes #723, #242 and #473.

What problem does this address?

  • When a run fails, report its failure to Slackbot
  • When a run succeeds, add its file size change type to the report to enable rapid-fire assessments of the scale of the changes.
  • Convert this size change from bytes to MB. We don't make this actual conversion in the datapackage, just in the report-out.

What did you change in this PR?

  • Save logs from GHA
  • Parse non-validation errors from these logs and report out to Slack
  • Report out file size changes

Note that nothing in the datapackage itself or the actual validation process is changed, this is all affecting the GHA and reporting layers.

Testing

How did you make sure this worked? How can a reviewer verify this?

See the following runs and their corresponding messages:

To-do list

  • Concat all no changes into one block to avoid "no more than 50 items" error
  • Update relevant documentation - like comments, docstrings, README, release notes, etc.
  • Review the PR yourself and call out any questions or issues you have

@e-belfer e-belfer self-assigned this Jul 8, 2025
@e-belfer e-belfer linked an issue Jul 8, 2025 that may be closed by this pull request
@e-belfer e-belfer moved this from New to In progress in Catalyst Megaproject Jul 8, 2025
@e-belfer e-belfer added github_actions Pull requests that update GitHub Actions code automation Issues relating to automated archiver runs labels Jul 8, 2025
@e-belfer e-belfer moved this from In progress to In review in Catalyst Megaproject Jul 8, 2025
@e-belfer e-belfer requested a review from aesharpe July 8, 2025 18:27
Copy link
Member

@aesharpe aesharpe left a comment

Choose a reason for hiding this comment

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

I might pass this on to @cmgosnell or @krivard for another review, but wondering why the FERC 6 archiver change outputs look like this:

 "UPDATE": [
    {
      "ferc6-xbrl-2014.zip": -0.0
    },
    {
      "ferc6-xbrl-2015.zip": -0.0

Is this because of the rounding? I'm assuming it's just a verrryyyy small number.

Comment on lines 89 to 91
# Convert the size diff to MB for speed of assessment, and round
{change["name"]: round(change["size_diff"] * (2**-20), 4)}
)
Copy link
Member

Choose a reason for hiding this comment

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

If you're converting from bytes to MB, wouldn't it be 1**-6?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly binary math should run the game here, not SI units - https://www.calculatinghub.com/converters/data/bytes-to-mb-converter/

Copy link
Contributor

Choose a reason for hiding this comment

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

Austen is right here though; using binary math gives you mebibytes (MiB) not megabytes (MB). MB have been SI units since 1998!

@e-belfer
Copy link
Member Author

e-belfer commented Jul 8, 2025

I might pass this on to @cmgosnell or @krivard for another review, but wondering why the FERC 6 archiver change outputs look like this:

 "UPDATE": [
    {
      "ferc6-xbrl-2014.zip": -0.0
    },
    {
      "ferc6-xbrl-2015.zip": -0.0

Is this because of the rounding? I'm assuming it's just a verrryyyy small number.

Right now FERC archives always change a tiny bit. @zschira is currently working on fixing this in https://github.com/catalyst-cooperative/pudl-archiver/tree/refs/heads/ferc-stable-archives, but I chose to use it in testing to get a sense of what it would look like to visualize basically zero byte changes with MBs instead of bytes.

Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

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

Fix the units thing for sure; other than that I'm just being nosy and this is fine

Comment on lines 134 to 136
if (
error_file.exists() and error_file.stat().st_size > 0
): # Handle case where no files are found or file is empty
Copy link
Contributor

Choose a reason for hiding this comment

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

what causes the script to sometimes receive a filename that doesn't exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it should be fine without this, let me see if it breaks!


error_blocks = list(
itertools.chain.from_iterable(
_format_errors(e) for e in errors if _format_errors(e) is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than calling _format_errors twice, consider

Suggested change
_format_errors(e) for e in errors if _format_errors(e) is not None
filter(None, (_format_errors(e) for e in errors))

@jdangerx
Copy link
Member

Does this also close #474 ? With all the github issue stuff this ended up touching?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Issues relating to automated archiver runs github_actions Pull requests that update GitHub Actions code
Projects
Status: In review
4 participants