plovegro opened a new issue, #53162:
URL: https://github.com/apache/airflow/issues/53162
### Apache Airflow version
3.0.2
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
I am attempting to implement a listener on task success ( or dag success -
either one doesnt work). Here is a sample of my code
plugin code
```
from airflow.plugins_manager import AirflowPlugin
from listeners_code import on_task_instance_running,
on_dag_run_running,on_task_instance_success
class MyListenerPlugin(AirflowPlugin):
name = "my_listener_plugin"
listeners = [on_task_instance_success]
```
Listener code
```
@hookimpl
def on_task_instance_success(
previous_state: TaskInstanceState, task_instance: RuntimeTaskInstance |
TaskInstance
):
# Define the API endpoint
url = "https://webhook.site/837dc4b3-d42d-4a7a-a61f-5a633e2ec78a"
# Send a GET request
response = requests.get(url)
# Check if the request was successful
if response.status_code == 200:
data = response.json() # Parse JSON response
print("Title:", data["title"])
else:
print(f"Request failed with status code {response.status_code}")
```
Previously this listener was just logging a message, which i couldnt see -
so i followed a suggestion on here about trying to call an external api - no
request is fired to that external api.
I run my DAG with 2 tasks, and they both succeeded but nothing is firing off
from my listener code.
### What you think should happen instead?
My listener code should fire.
### How to reproduce
Add plugin code in /plugins folder and restart docker.
### Operating System
Ubuntu 24
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
Just followed docs from airflow website - docker compose build, docker
compose up.
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]