WordPress / openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
https://openverse.org
MIT License
240 stars 194 forks source link

`notify_slack` should determine `dag_id` on its own #4884

Open AetherUnbound opened 3 weeks ago

AetherUnbound commented 3 weeks ago

Description

Since common.slack.notify_slack is an Airflow TaskFlow API @task, it has access to the context variables: https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/taskflow.html#context

Thus, we should be able to have it determine the dag_id on its own (via the dag.dag_id property of the dag object available for templating).

This function will need to be changed to remove the dag_id required parameter from the outer function call, add dag: DAG | None = None at the end of the argument list, and then pass dag.dag_id into the send_message call:

https://github.com/WordPress/openverse/blob/7f5baa29f1c5f0e09266946bd2c1a2f321d6f07a/catalog/dags/common/slack.py#L421-L433

triii10 commented 2 weeks ago

Hi, I'm new to contributing to public OpenSource projects and would like to take this up if available.

AetherUnbound commented 2 weeks ago

Hi @triii10 , thank you for your interest in contributing to Openverse! I've assigned this issue to you. If you have any questions, you may leave them here.

Please check out our welcome and general setup documentation pages for getting started with setting up your local environment.