r888800009 opened a new issue, #30387:
URL: https://github.com/apache/airflow/issues/30387

   ### Apache Airflow Provider(s)
   
   telegram
   
   ### Versions of Apache Airflow Providers
   
   ```
   apache-airflow-providers-telegram==4.0.0
   python-telegram-bot==20.2
   apache-airflow==2.5.2
   ```
   
   
   ### Apache Airflow version
   
   2.5.2
   
   ### Operating System
   
   macOS 12.2 21D49 arm64 (apple silicon)
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   **airflow standalone** and airflow standalone config to **LocalExecutor** 
with **PostgreSQL** still has problem
   
   Python 3.10.10 (main, Feb  8 2023, 05:32:04)
   pip 23.0.1 from /opt/homebrew/lib/python3.10/site-packages/pip 
   
   Postgres 2.6
   
   ### What happened
   
   Whenever the telegram operator is running, telegram will not receive any 
messages. Check the log in airflow and you can see that the task is stuck at 
`Using connection ID 'telegram_conn_id' for task execution.` for more than ten 
minutes without throwing any errors.
   
   ```
   *** Reading local file: 
/Users/Username/airflow/logs/dag_id=telegram/run_id=manual__2023-03-31T10:31:39.872541+00:00/task_id=send_message_telegram_task/attempt=1.log
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1084} INFO - Dependencies all 
met for dep_context=non-requeueable deps ti=<TaskInstance: 
telegram.send_message_telegram_task manual__2023-03-31T10:31:39.872541+00:00 
[queued]>
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1084} INFO - Dependencies all 
met for dep_context=requeueable deps ti=<TaskInstance: 
telegram.send_message_telegram_task manual__2023-03-31T10:31:39.872541+00:00 
[queued]>
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1282} INFO - 
   
--------------------------------------------------------------------------------
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1283} INFO - Starting attempt 1 
of 1
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1284} INFO - 
   
--------------------------------------------------------------------------------
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1303} INFO - Executing 
<Task(TelegramOperator): send_message_telegram_task> on 2023-03-31 
10:31:39.872541+00:00
   [2023-03-31, 18:31:44 CST] {standard_task_runner.py:55} INFO - Started 
process 35722 to run task
   [2023-03-31, 18:31:44 CST] {standard_task_runner.py:82} INFO - Running: 
['airflow', 'tasks', 'run', 'telegram', 'send_message_telegram_task', 
'manual__2023-03-31T10:31:39.872541+00:00', '--job-id', '53', '--raw', 
'--subdir', 'DAGS_FOLDER/telegram_operator_example.py', '--cfg-path', 
'/var/folders/zz/zyxvpxvq6csvxfm_n000jt7w004fjz/T/tmpw7khjcg3']
   [2023-03-31, 18:31:44 CST] {standard_task_runner.py:83} INFO - Job 53: 
Subtask send_message_telegram_task
   [2023-03-31, 18:31:44 CST] {task_command.py:388} INFO - Running 
<TaskInstance: telegram.send_message_telegram_task 
manual__2023-03-31T10:31:39.872541+00:00 [running]> on host myhostname
   [2023-03-31, 18:31:44 CST] {taskinstance.py:1509} INFO - Exporting the 
following env vars:
   AIRFLOW_CTX_DAG_OWNER=airflow
   AIRFLOW_CTX_DAG_ID=telegram
   AIRFLOW_CTX_TASK_ID=send_message_telegram_task
   AIRFLOW_CTX_EXECUTION_DATE=2023-03-31T10:31:39.872541+00:00
   AIRFLOW_CTX_TRY_NUMBER=1
   AIRFLOW_CTX_DAG_RUN_ID=manual__2023-03-31T10:31:39.872541+00:00
   [2023-03-31, 18:31:44 CST] {base.py:73} INFO - Using connection ID 
'telegram_conn_id' for task execution.
   ```
   
   <img width="772" alt="image" 
src="https://user-images.githubusercontent.com/14235139/229103043-ad82bd41-9900-4014-835b-2ec8b98431c1.png";>
   
   ### What you think should happen instead
   
   telegram should receive the message, and the task should mark as successful, 
it should be completed within minutes, if it takes too long, it should throw a 
timeout or error to locate the line number or configuration
   
   
   ### How to reproduce
   
   
   ```python
   from datetime import datetime
   from airflow import DAG
   from airflow.providers.telegram.operators.telegram import TelegramOperator
   
   with DAG("telegram", start_date=datetime(2021, 1, 1), tags=["example"]) as 
dag:
       send_message_telegram_task = TelegramOperator(
           task_id="send_message_telegram_task",
           telegram_conn_id="telegram_conn_id",
           chat_id="here_your_telegram_id", # example "-3222103937"
           text="Hello from Airflow!",
           dag=dag,
       )
   ```
   1. copy this code to `~/airflow/dags/telegram_operator_example.py`
   2. add a connection, name is `telegram_conn_id`, and follow the 
[TelegramOperator — apache-airflow-providers-telegram 
Documentation](https://airflow.apache.org/docs/apache-airflow-providers-telegram/stable/operators.html#using-the-operator)
 add the connection
   3. modify `chat_id` to  your telegram id, for example `"-3222103937"` and 
save
   4. run dag, you can see that the task is stuck
   
   ### Anything else
   
   Every run
   
   ### 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]

Reply via email to