-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Airflow 1.10.7+ suppresses Operator logs #8484
Comments
Steps to reproduce:
|
Did you manage to find resolution to this? |
Interesting. I actually tried this on a fresh docker container and it still didn't print the logs. |
We experienced a similar issue after upgrading from 1.10.3 to 1.10.9: no more task logging visible in the UI. In our case it was specifically for the KubernetesPodOperator, but not for the BashOperator for instance. We fixed it by adding a logger for the airflow.contrib package (in the main airflow logging configuration file, see snippet below), since the KubernetesPodOperator lives there. So if the operator you're missing logs from is also from the contrib package, you can try this fix to see if it re-appears. Probably it also works for other operators, as long as you specify the right package they are in as extra logger. My guess is that the combination of forking instead of starting a whole new process + having no specific logger for the package triggered this particular issue. Added log config snippet:
|
@ewjmulder You added this to airflow_local_settings.py? And, for airflow.contrib, did you import something on there? because I'm failing to find where and what you did to be honest. Would appreciate if you could be a bit more specific. |
@davido912 In the Airflow project the example config is in the airflow_local_settings.py file indeed. But you can customize this with the |
@ewjmulder seems to work, nice job! |
Yes, I guess the issue is related to an upgrade from an older version where you also (try to) migrate the log config but somehow they are not fully compatible and this issue appears. If someone does a deep dive into the diffs on the logging config and code between 1.10.6 and 1.10.7 I'm sure some underlying reason will pop up. But I'm happy with the resolution that we have found :) |
Could you all share the different operators where you've seen this happen? Looks like it's an issue on KubernetesPodOperator? I was unable to attempted to replicate with PythonOperator. |
Indeed for us it was a problem for the KubernetesPodOperator but not for the PythonOperator. Looking at the top post it also affects the DataprocOperator, which also lives in the contrib package. So it seems the direction to look in is loggers for certain packages and default behavior if no logger is configured for a package. |
For us, it's happening across all operators. I have seen this with
pythonoperator ( see above steps) and also with dataprocoperator and a few
others.
I have tried this with a fresh airflow installation in a container and it's
still behaved the same way.
…On Sat, May 16, 2020, 7:27 AM Erik Mulder ***@***.***> wrote:
Indeed for us it was a problem for the KubernetesPodOperator but not for
the PythonOperator. Looking at the top post it also affects the
DataprocOperator, which also lives in the contrib package. So it seems the
direction to look in is loggers for certain packages and default behavior
if no logger is configured for a package.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8484 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC2PGZADWKJMMD5W7LXSWTRRYP4XANCNFSM4MNHCQDQ>
.
|
Had a chance to skim through #6627 and I could be mistaken (have not found the time to grok through all of the moving parts yet) but it seems like using airflow/airflow/task/task_runner/standard_task_runner.py Lines 80 to 84 in 8465d66
From the python docs:
Perhaps what's in order is a |
Is anyone able to make a clean, stand-alone reproduction case that shows this please? (Ideally in the form of a docker image I can pull, or a git repo we can clone) |
same here, the only way to get logs working - downgrading to 1.10.7, it started to happen since 1.10.9 for us, (we skipped 1.10.8) |
Here is the DAG you can launch and see by yourself. import logging.config
import os
from datetime import datetime, timedelta
from time import sleep
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] PID=%(process)d:TID=%(thread)d '
'%(name)s.%(funcName)s:%(lineno)d: %(message)s'
},
},
'handlers': {
'default': {
'level': os.getenv('LOGGING_LEVEL', 'INFO'),
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout',
'formatter': 'standard'
},
},
'loggers': {
'': {
'handlers': ['default'],
'level': os.getenv('LOGGING_LEVEL', 'INFO'),
'propagate': True
}
}
}
logging.config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger(__name__)
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2018, 6, 10),
'catchup': False,
'email': ['[email protected]'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 3,
'retry_delay': timedelta(seconds=5),
'max_retry_delay': timedelta(seconds=60),
'retry_exponential_backoff': False,
}
dag = DAG(dag_id='aaa_test_logging', catchup=False, default_args=default_args,
schedule_interval=None, max_active_runs=1)
def aaa_test_logging(**kwargs):
logger.info('aaa_test_logging START before sleep')
sleep(5*60)
logger.info('aaa_test_logging END after sleep')
def generate():
PythonOperator(
task_id=f'aaa_test_logging',
python_callable=aaa_test_logging,
provide_context=True,
dag=dag,
)
generate() |
Here is workaround: #6627 (comment) |
The fix will be available in 1.10.11 |
One of the way we could resolve the same problem in our Airflow v 1.10.10 instance is by using a shell script as an extry point to execute the python application. The sys exit is part of the shell script. Earlier we invoked the python application directly from the |
First reported at https://issues.apache.org/jira/browse/AIRFLOW-6904 by Rahul Jain.
After upgrading from 1.10.2 to 1.10.9, we noticed that the Operator logs are no longer printed.
1.10.2:
1.10.9:
This worked fine with Airflow <=1.10.6 and was most likely caused by our change to using os.fork (#6627).
The text was updated successfully, but these errors were encountered: