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

   ## Description
   
   According to #66592:
   
   > When using `KubernetesJobOperator` with `do_xcom_push=True`, the task 
returns the content of JSON file found at `/airflow/xcom/return.json` in k8s 
pod as a return_value XCom, but the data type of the returned XCom value varies 
depending on whether the deferrable paramter was set to `True` or `False`:
   > 
   > - When `deferrable=True` parameter is supplied, `KubernetesJobOperator` 
returns XCom value with data type of `dict`
   > - When `deferrable=False` parameter is supplied, `KubernetesJobOperator` 
returns XCom value with data type of `list[dict]`
   
   This PR remedies this issue by "unwrapping" the `xcom_result` if the 
following condition is met: `if self.unwrap_single and len(xcom_result) == 1`. 
This ensures that the behavior for non-deferrable execution matches that of 
deferrable execution, providing parity for users.
   
   ## Testing
   
   These changes were testing using the newly-created 
`test_execute_xcom_respects_unwrap_single` unit test. This test can be run 
using the command below.
   
   ```bash
   breeze testing providers-tests 
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py
   ```
   
   * closes: #66592 
   
   ##### Was generative AI tooling used to co-author this PR?
   
   No, generative AI was not used to co-author this PR.


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