vatsrahul1001 opened a new pull request, #69919:
URL: https://github.com/apache/airflow/pull/69919

   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   -->
   
   ## What
   
   The Celery worker CLI passes `json_output` to 
`airflow.sdk.log.configure_logging` under an `AIRFLOW_V_3_0_PLUS` gate (added 
in #68916 "Honor json_logs config in Celery worker startup"):
   
   ```python
   if AIRFLOW_V_3_0_PLUS:
       from airflow.sdk.log import configure_logging
       ...
       configure_logging(output=sys.stdout.buffer, json_output=json_output)
   ```
   
   But `json_output` was only added to the Task SDK's `configure_logging` in 
**SDK 1.1 / Airflow 3.1** (the structlog migration, #52651). On **Airflow 
3.0.x** that parameter does not exist, so the call raises:
   
   ```
   TypeError: configure_logging() got an unexpected keyword argument 
'json_output'
   ```
   
   …and the Celery worker crashes on startup. The `AIRFLOW_V_3_0_PLUS` gate is 
simply too loose — this affects any plain Airflow 3.0.x deployment running 
celery provider >= 3.22.0.
   
   ## How
   
   - Add an `AIRFLOW_V_3_1_PLUS` constant to the provider's `version_compat`.
   - Gate the `json_logs` handling on `AIRFLOW_V_3_1_PLUS`. On Airflow 3.0.x, 
fall back to `configure_logging(output=sys.stdout.buffer)` (no `json_output`), 
which matches the pre-#68916 behavior.
   
   This keeps the provider compatible across the full Airflow 3.x range it 
declares support for. The `json_logs` feature is honored from 3.1+ where the 
SDK actually supports it.
   
   ## Tests
   
   Added `test_json_output_not_passed_on_airflow_3_0` which patches 
`AIRFLOW_V_3_1_PLUS = False` and asserts `configure_logging` is called without 
`json_output`. Existing `json_logs` tests continue to assert the 3.1+ behavior.
   
   ---
   
   <!-- Please keep an empty line above the dashes. -->
   - [x] Bugfix; no user-facing config or docs changes required.


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