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

Fix date range sent to Slack from reingestion workflows #4093

Conversation

BaileyMcKelway
Copy link
Contributor

@BaileyMcKelway BaileyMcKelway commented Apr 12, 2024

Fixes

Fixes #3964 by @stacimc

Description

The create_report_load_completion function has been modified to conditionally add date range parameters to the Slack notification based on whether the workflow is a reingestion process. This prevents misleading date range information from being included in reingestion notifications.

Testing Instructions

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate 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.
  • I ran the DAG documentation generator (if applicable).

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.

@BaileyMcKelway BaileyMcKelway requested a review from a team as a code owner April 12, 2024 00:04
@BaileyMcKelway BaileyMcKelway changed the title Reingestion workflows report misleading date range to Slack [DRAFT] Reingestion workflows report misleading date range to Slack Apr 12, 2024
@openverse-bot openverse-bot added 🟩 priority: low Low priority and doesn't need to be rushed 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🏷 status: label work required Needs proper labelling before it can be worked on labels Apr 12, 2024
@BaileyMcKelway BaileyMcKelway changed the title [DRAFT] Reingestion workflows report misleading date range to Slack Reingestion workflows report misleading date range to Slack Apr 12, 2024
@BaileyMcKelway BaileyMcKelway marked this pull request as draft April 12, 2024 00:18
@obulat obulat added 🧱 stack: catalog Related to the catalog and Airflow DAGs and removed 🏷 status: label work required Needs proper labelling before it can be worked on 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Apr 12, 2024
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.

These keyword-arguments are being passed to the

def report_completion(
Python function. That function will also need some changes to remove the date-information line from the actual message that gets sent to Slack.

…ified reporting function to handle reingestion workflows
@BaileyMcKelway
Copy link
Contributor Author

These keyword-arguments are being passed to the

def report_completion(

Python function. That function will also need some changes to remove the date-information line from the actual message that gets sent to Slack.

Alright changes are made in the new commit.

@BaileyMcKelway
Copy link
Contributor Author

How can I check the Slack message locally? I ran Airflow locally and triggered the DAGs but is it possible to trigger the Slack message?

@BaileyMcKelway BaileyMcKelway marked this pull request as ready for review April 12, 2024 22:40
@dhruvkb
Copy link
Member

dhruvkb commented Apr 15, 2024

@BaileyMcKelway since the Slack webhooks are configured for our internal workspace, it wouldn't be possible for you to trigger the message and see it for real. But you can make up a pseudo-preview of the message like this.

  1. See the text logged by the send_message function.
  2. Go to Slack's Block Kit Builder. You will need to sign in with your "Making WordPress" Slack credentials.
  3. Replace <enter your message here> with the log message and paste it into the Block builder's right pane.
    {
      "blocks": [
        {
           "type": "section",
           "text": {
             "type": "mrkdwn",
             "text": "<enter your message here>"
           }
        }
      ]
    }

Here's an example.

This should give you an approximate idea of what the message will look like.

Copy link
Contributor

@AetherUnbound AetherUnbound 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 for your contribution @BaileyMcKelway! I have a few idiomatic suggestions for the code, and one requested change regarding the message text. I greatly appreciate the new test!

catalog/dags/common/loader/reporting.py Outdated Show resolved Hide resolved
catalog/dags/providers/provider_dag_factory.py Outdated Show resolved Hide resolved
catalog/tests/dags/providers/test_provider_dag_factory.py Outdated Show resolved Hide resolved
BaileyMcKelway and others added 3 commits April 15, 2024 18:25
…n_dag

Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
…error handling

Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
@BaileyMcKelway
Copy link
Contributor Author

Thanks again for your contribution @BaileyMcKelway! I have a few idiomatic suggestions for the code, and one requested change regarding the message text. I greatly appreciate the new test!

Alrighty committed suggested changes. 🫡

@BaileyMcKelway BaileyMcKelway requested a review from a team as a code owner April 15, 2024 23:09
catalog/dags/common/loader/reporting.py Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Tested this locally, and this is what the sample message looked like:
image

Seems great!

@BaileyMcKelway
Copy link
Contributor Author

Tested this locally, and this is what the sample message looked like: image

Seems great!

Do I need to ping somebody else to review?

Referring to this, "At least 2 approving reviews are required to merge this pull request."

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.

We'll I've already reviewed it and it LGTM, so I should approve it too. Thanks for the contribution @BaileyMcKelway!

@dhruvkb dhruvkb changed the title Reingestion workflows report misleading date range to Slack Fix date range sent to Slack from reingestion workflows Apr 18, 2024
@dhruvkb dhruvkb merged commit c78bac3 into WordPress:main Apr 18, 2024
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: catalog Related to the catalog and Airflow DAGs
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Reingestion workflows report misleading date range to Slack
5 participants