potiuk commented on issue #37228:
URL: https://github.com/apache/airflow/issues/37228#issuecomment-1934086764

   Well, those messages come from your DAG or configuraiton (local settings) 
while the dags are being parsed. Just don't print output to stdout in your DAGs 
when they are parsed. 
   
   Look for the places where your DAGs write those messages. The problem is 
that parsing DAG executes your code so if you do something in your code to use 
stderr, this creates the problem.
   
   We currently suppress logs and warnings for all commands that return any 
json output with decorator below - but it does not suppress stuff that you 
print manually in your dags using `print()`
   
   Generally it's a good practice to use logging facilities to print 
diagnostics info rather than printing to stdout directly. 
   
   ```
   def suppress_logs_and_warning(f: T) -> T:
       """Suppress logging and warning messages in cli functions."""
   
       @functools.wraps(f)
       def _wrapper(*args, **kwargs):
           _check_cli_args(args)
           if args[0].verbose:
               f(*args, **kwargs)
           else:
               with warnings.catch_warnings():
                   warnings.simplefilter("ignore")
                   logging.disable(logging.CRITICAL)
                   try:
                       f(*args, **kwargs)
                   finally:
                       # logging output again depends on the effective
                       # levels of individual loggers
                       logging.disable(logging.NOTSET)
   
       return cast(T, _wrapper)
   ```
   
   


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