potiuk commented on PR #65162:
URL: https://github.com/apache/airflow/pull/65162#issuecomment-4238400440
Out of curiosity - because It seems that with request scope we are going to
keep opened database session throughout the whole streaming.
Would not that be better (and getting read of the Fast API Dependency ?
```python
with _get_session() as session:
tis = session.execute(
select(
TaskInstance.task_id,
TaskInstance.state,
TaskInstance.dag_version_id,
TaskInstance.start_date,
TaskInstance.end_date,
DagVersion.version_number,
)
.outerjoin(DagVersion, TaskInstance.dag_version_id ==
DagVersion.id)
.where(TaskInstance.dag_id == dag_id)
.where(TaskInstance.run_id == run_id)
.order_by(TaskInstance.task_id)
.execution_options(yield_per=1000)
)
summary = _build_ti_summaries(
dag_id,
run_id,
tis,
session,
serdag_cache=serdag_cache,
)
if summary is None:
continue
```
I probably miss something about async behaviour here (maybe?) but this one
would only keep session only for single run_id retrieval and free it while the
task summary is being streamed?
It seems a bit wasteful to keep the sesssion opened and held whlie we are
essentially streaming data back? Or am I wrong?
--
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]