felipeangelimvieira commented on issue #18041:
URL: https://github.com/apache/airflow/issues/18041#issuecomment-919964320


   Hello @ephraimbuddy,
   
   We are facing the same issue...
   I'm using the official airflow helm chart in a Azure Kubernetes Service, 
with LocalExecutor. Different values for 
AIRFLOW__SCHEDULER__SCHEDULE_AFTER_TASK_EXECUTION give different error 
messages... 
   
   Here it is an example dag to reproduce it:
   
   ```python
   from airflow import DAG
   from airflow.operators.python import PythonOperator
   
   import time
   from datetime import datetime
   
   dag = DAG('dag_test',
             description='test',
             schedule_interval=None,
             start_date=datetime(2021, 4, 1),
             max_active_runs=1,
             concurrency=40,
             catchup=False)
   
   
   def my_sleeping_function(t):
       time.sleep(t)
   
   
   tasks = []
   for i in range(400):
       task = PythonOperator(task_id='sleep_for_' + str(i),
                             python_callable=my_sleeping_function,
                             op_kwargs={'t': 60},
                             dag=dag)
   
   ```
   
   **With AIRFLOW__SCHEDULER__SCHEDULE_AFTER_TASK_EXECUTION=true**
   
   
   ```
   *** Reading local file: 
/opt/airflow/logs/airflow2/dag_test/sleep_for_0/2021-09-15T11:52:24.627715+00:00/1.log
   [2021-09-15 11:54:59,531] {taskinstance.py:896} INFO - Dependencies all met 
for <TaskInstance: dag_test.sleep_for_0 2021-09-15T11:52:24.627715+00:00 
[queued]>
   [2021-09-15 11:54:59,583] {taskinstance.py:896} INFO - Dependencies all met 
for <TaskInstance: dag_test.sleep_for_0 2021-09-15T11:52:24.627715+00:00 
[queued]>
   [2021-09-15 11:54:59,583] {taskinstance.py:1087} INFO - 
   
--------------------------------------------------------------------------------
   [2021-09-15 11:54:59,583] {taskinstance.py:1088} INFO - Starting attempt 1 
of 1
   [2021-09-15 11:54:59,583] {taskinstance.py:1089} INFO - 
   
--------------------------------------------------------------------------------
   [2021-09-15 11:55:04,450] {taskinstance.py:1107} INFO - Executing 
<Task(PythonOperator): sleep_for_0> on 2021-09-15T11:52:24.627715+00:00
   [2021-09-15 11:55:04,454] {standard_task_runner.py:52} INFO - Started 
process 1657 to run task
   [2021-09-15 11:55:04,458] {standard_task_runner.py:76} INFO - Running: 
['airflow', 'tasks', 'run', 'dag_test', 'sleep_for_0', 
'2021-09-15T11:52:24.627715+00:00', '--job-id', '33893', '--pool', 
'default_pool', '--raw', '--subdir', 'DAGS_FOLDER/other/dag_test_bug.py', 
'--cfg-path', '/tmp/tmpcwh5nv0m', '--error-file', '/tmp/tmp8t0t_nvu']
   [2021-09-15 11:55:04,459] {standard_task_runner.py:77} INFO - Job 33893: 
Subtask sleep_for_0
   [2021-09-15 11:55:29,043] {logging_mixin.py:104} INFO - Running 
<TaskInstance: dag_test.sleep_for_0 2021-09-15T11:52:24.627715+00:00 [running]> 
on host airflow-scheduler-0.airflow-scheduler.airflow.svc.cluster.local
   [2021-09-15 11:56:02,766] {taskinstance.py:1302} INFO - Exporting the 
following env vars:
   AIRFLOW_CTX_DAG_OWNER=airflow
   AIRFLOW_CTX_DAG_ID=dag_test
   AIRFLOW_CTX_TASK_ID=sleep_for_0
   AIRFLOW_CTX_EXECUTION_DATE=2021-09-15T11:52:24.627715+00:00
   AIRFLOW_CTX_DAG_RUN_ID=manual__2021-09-15T11:52:24.627715+00:00
   [2021-09-15 11:57:00,870] {local_task_job.py:77} ERROR - Received SIGTERM. 
Terminating subprocesses
   [2021-09-15 11:57:00,916] {process_utils.py:100} INFO - Sending 
Signals.SIGTERM to GPID 1657
   [2021-09-15 11:57:00,916] {taskinstance.py:1284} ERROR - Received SIGTERM. 
Terminating subprocesses.
   ```  
   
   
   **With AIRFLOW__SCHEDULER__SCHEDULE_AFTER_TASK_EXECUTION=false**
   
   ```
   *** Reading local file: 
/opt/airflow/logs/airflow2/dag_test/sleep_for_0/2021-09-15T11:52:24.627715+00:00/2.log
   [2021-09-15 11:59:52,836] {taskinstance.py:896} INFO - Dependencies all met 
for <TaskInstance: dag_test.sleep_for_0 2021-09-15T11:52:24.627715+00:00 
[queued]>
   [2021-09-15 11:59:57,228] {taskinstance.py:896} INFO - Dependencies all met 
for <TaskInstance: dag_test.sleep_for_0 2021-09-15T11:52:24.627715+00:00 
[queued]>
   [2021-09-15 11:59:57,228] {taskinstance.py:1087} INFO - 
   
--------------------------------------------------------------------------------
   [2021-09-15 11:59:57,228] {taskinstance.py:1088} INFO - Starting attempt 2 
of 2
   [2021-09-15 11:59:57,228] {taskinstance.py:1089} INFO - 
   
--------------------------------------------------------------------------------
   [2021-09-15 11:59:57,253] {taskinstance.py:1107} INFO - Executing 
<Task(PythonOperator): sleep_for_0> on 2021-09-15T11:52:24.627715+00:00
   [2021-09-15 11:59:57,256] {standard_task_runner.py:52} INFO - Started 
process 814 to run task
   [2021-09-15 11:59:57,258] {standard_task_runner.py:76} INFO - Running: 
['airflow', 'tasks', 'run', 'dag_test', 'sleep_for_0', 
'2021-09-15T11:52:24.627715+00:00', '--job-id', '33947', '--pool', 
'default_pool', '--raw', '--subdir', 'DAGS_FOLDER/other/dag_test_bug.py', 
'--cfg-path', '/tmp/tmpe7l0bnkn', '--error-file', '/tmp/tmppppc4ghm']
   [2021-09-15 11:59:57,260] {standard_task_runner.py:77} INFO - Job 33947: 
Subtask sleep_for_0
   [2021-09-15 12:00:18,910] {logging_mixin.py:104} INFO - Running 
<TaskInstance: dag_test.sleep_for_0 2021-09-15T11:52:24.627715+00:00 [running]> 
on host airflow-scheduler-0.airflow-scheduler.airflow.svc.cluster.local
   [2021-09-15 12:00:27,276] {local_task_job.py:194} WARNING - Recorded pid 
1657 does not match the current pid 814
   [2021-09-15 12:00:27,283] {process_utils.py:100} INFO - Sending 
Signals.SIGTERM to GPID 814
   [2021-09-15 12:00:27,303] {process_utils.py:66} INFO - Process 
psutil.Process(pid=814, status='terminated', exitcode=<Negsignal.SIGTERM: -15>, 
started='11:59:57') (814) terminated with exit code Negsignal.SIGTERM
   
   ```
   
   Some tasks succeed and others are randomly killed.


-- 
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