Skip to content

DuckDB chunk query blocks async executor #30

@kylebarron

Description

@kylebarron

async def _run_one_date(
t_idx: int,
plan: _ChunkReadPlan,
) -> dict[str, np.ndarray] | None:
"""Read and mosaic all COGs for a single time step.
Issues one DuckDB query for items overlapping the chunk at this date, then
calls async_mosaic_chunk to fetch and reproject all tiles.
Returns None if no items match the query.
Args:
t_idx: Index into ``plan.dates`` for the time step to read.
plan: Read plan carrying all parameters for this chunk.
Returns:
Per-band arrays keyed by band name, or ``None`` if no items matched.
"""
date = plan.dates[t_idx]
with plan.duckdb_lock:
items = _search_items(
plan.duckdb_client,
plan.parquet_path,
plan.chunk_bbox_4326,
date,
plan.sortby,
plan.filter_expr,
plan.ids,
plan.filter_fields,
label=f"bands={plan.selected_bands!r}",
)

This looks to be a synchronous, blocking duckdb call inside the main-thread async executor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions