kavya-5 opened a new issue, #23499:
URL: https://github.com/apache/airflow/issues/23499
### Apache Airflow version
2.2.3
### What happened
Hi, I am running a DAG in airflow that takes custom params as input.
This param is passed to a PythonOperator to be used in the logic.
This PythonOperator is expected to run for at least 12 hours until a
condition is met. But, there is an error encountered in within few mins maybe
about 20 mins from the start of the task (PythonOperator) that is `ERROR -
LocalTaskJob heartbeat got an exception`
There is also another exception : `sqlalchemy.exc.OperationalError:
(psycopg2.OperationalError) connection to server at
"airflow-sqlproxy-service.default.svc.cluster.local" (10.67.240.74), port 3306
failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.`
### What you think should happen instead
Before using the custom params, these PythonOperators would run for 12 hours
and execute the tasks successfully.
This ERROR occurred after switching to params.
### How to reproduce
To reproduce this issue, maybe one can excute a PythonOperatro as follows
```
with models.DAG(
'Test_dag',
schedule_interval='0 0 * * *',
start_date=dt.datetime(2022,4,14),
default_args={
'depends_on_past': False,
'retries': 10,
'retry_delay': timedelta(minutes=10)
},
params={
"date": date.today().strftime("%Y%m%d")
},
catchup=False) as dag:
checktime = PythonOperator(
task_id= "Check_time",
python_callable= checkTime,
op_kwargs={
"date": "{{params.date}}",
},
dag=dag,
)
def checkTime(date):
today=dt.datetime.strptime(date, "%Y%m%d")
runtime=today.replace(hour=12, minute=0, second=0, microsecond=0)
import time
while True:
current_time = dt.datetime.now()
if current_time>=runtime:
break
else:
time.sleep(45)
```
### Operating System
I am running Airflow on Google Cloud Composer, which is managed Airflow
service by Google Cloud
### Versions of Apache Airflow Providers
_No response_
### Deployment
Composer
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [X] 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]