Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Data refresh slack notifications #421

Merged
merged 7 commits into from
Jan 4, 2022

Conversation

AetherUnbound
Copy link
Contributor

Fixes

Fixes #412 by @AetherUnbound

Description

This PR adds a very simple slack notification mechanism for the ingestion server. During data refresh, the ingestion server will give periodic updates in slack regarding the progress of a given data refresh. If the refresh fails at any point, the ingestion server will also send the exception to Slack.

Examples:

image
image
image

Testing Instructions

  1. Set the SLACK_WEBHOOK variable in env.docker
  2. Spin up the stack
  3. Run just ingest-upstream

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@AetherUnbound AetherUnbound added 🟨 priority: medium Not blocking but should be addressed soon ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository 🐍 tech: python Requires familiarity with Python labels Dec 21, 2021
@AetherUnbound AetherUnbound requested review from a team, rbadillap and sarayourfriend and removed request for a team December 21, 2021 00:09
@sarayourfriend
Copy link
Contributor

@AetherUnbound you said that in real usage these notifications would likely be sent hours apart right? Just wanting to confirm that, otherwise I might suggest somehow updating the existing message for successful passes or something instead of sending a new one (but still sending a new message if it fails) 😅

Should failures ping @here or something like that? How important are they to take immediate action on?

@AetherUnbound
Copy link
Contributor Author

Yes! In production, it'll be a few hours between each step. For example, here are the rough runtimes based on the image table:

  • Data copy: ~5 hours
  • Data cleaning: ~14 hours
  • Re-apply index: ~6 hours
  • Elasticsearch reindex: ~6.5 hours
  • Elasticsearch promotion: ~2 hours

As for failures, I don't think we need to @here. The way the data refresh is built, it can fail anywhere along the way and production won't be affected, so there isn't a ton of urgency to responding to issues.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@AetherUnbound AetherUnbound requested a review from a team as a code owner December 21, 2021 18:47
Comment on lines 322 to 324
# The server sometimes hangs on or before this next step. Adding this debug
# message here because apparently that unblocks it? May have to do with GC.
log.debug("Getting downstream cursor again")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could try verifying this using gc.collect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm guessing that any additional call made here, prior to the database connection call, would unblock this step. Work a shot though 🤷‍♀️

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... any additional call... would that include like int("0") or something? I wonder what just calling a function could be causing it to clear 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure! What I noticed is that all of the following would cause code execution to continue as expected:

  • log.info
  • log.debug
  • print

I'm find leaving in the GC and seeing if it pops up again. It's frustrating because it's so intermittent!

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. I wonder if it's somehow IO related?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe! I'm really at a loss

@AetherUnbound AetherUnbound force-pushed the feature/data-refresh-slack-alerts#412 branch from b7f3629 to 1c8f2db Compare January 4, 2022 18:14
@AetherUnbound AetherUnbound merged commit a7aa53f into main Jan 4, 2022
@AetherUnbound AetherUnbound deleted the feature/data-refresh-slack-alerts#412 branch January 4, 2022 18:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟨 priority: medium Not blocking but should be addressed soon 🐍 tech: python Requires familiarity with Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ingestion server slack alerts
3 participants