Prab-27 commented on PR #52325:
URL: https://github.com/apache/airflow/pull/52325#issuecomment-3242186426
What do you think about these changes? I've applied them to two functions,
and all tests are passing
```
def test_value_storage(self, task_instance, mock_supervisor_comms, session):
session.add(task_instance)
session.commit()
XCom = resolve_xcom_backend()
airflow.models.xcom.XCom = XCom
XCom.set(
key=XCOM_RETURN_KEY,
value={"key": "bigvaluebigvaluebigvalue" * 100},
dag_id=task_instance.dag_id,
task_id=task_instance.task_id,
run_id=task_instance.run_id,
)
XComModel.set(
key=XCOM_RETURN_KEY,
value=self.path,
dag_id=task_instance.dag_id,
task_id=task_instance.task_id,
run_id=task_instance.run_id,
)
if AIRFLOW_V_3_1_PLUS:
res = session.execute(
XComModel.get_many(
key=XCOM_RETURN_KEY,
dag_ids=task_instance.dag_id,
task_ids=task_instance.task_id,
run_id=task_instance.run_id,
).with_only_columns(XComModel.value)
).first()
data = XComModel.deserialize_value(res)
elif AIRFLOW_V_3_0_PLUS:
res = (
XComModel.get_many(
key=XCOM_RETURN_KEY,
dag_ids=task_instance.dag_id,
task_ids=task_instance.task_id,
run_id=task_instance.run_id,
session=session,
)
.with_entities(XComModel.value)
.first()
)
data = XComModel.deserialize_value(res)
else:
res = (
XCom.get_many(
key=XCOM_RETURN_KEY,
dag_ids=task_instance.dag_id,
task_ids=task_instance.task_id,
run_id=task_instance.run_id,
session=session,
)
.with_entities(BaseXCom.value)
.first()
)
data = BaseXCom.deserialize_value(res)
p = XComObjectStorageBackend._get_full_path(data)
assert p.exists() is True
```
--
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]