What happened?
Description: In Python Enrichment, RequestResponseIO supports passing batching kwargs from Caller.batch_elements_kwargs() into BatchElements(**kwargs).
BatchElements supports max_batch_duration_secs, but BigQueryEnrichmentHandler currently only sets:
min_batch_size
max_batch_size
As a result, users of BigQueryEnrichmentHandler cannot configure max_batch_duration_secs, even though the downstream batching transform supports it.
Code path: BigQueryEnrichmentHandler -> Enrichment -> RequestResponseIO -> BatchElements
Current behavior max_batch_duration_secs is not available/configurable from BigQueryEnrichmentHandler and therefore is never forwarded to BatchElements.
Expected behavior BigQueryEnrichmentHandler should optionally accept max_batch_duration_secs and pass it through batch_elements_kwargs() when batching is enabled.
Proposed fix
- Add optional
max_batch_duration_secs: Optional[float] = None to BigQueryEnrichmentHandler.__init__.
- When
query_fn is not used, include it in _batching_kwargs (when provided).
Additional note: CloudSQLEnrichmentHandler appears to have the same batching-kwargs limitation and may benefit from parity in a follow-up or same PR.
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
What happened?
Description: In Python Enrichment,
RequestResponseIOsupports passing batching kwargs fromCaller.batch_elements_kwargs()intoBatchElements(**kwargs).BatchElementssupportsmax_batch_duration_secs, butBigQueryEnrichmentHandlercurrently only sets:min_batch_sizemax_batch_sizeAs a result, users of
BigQueryEnrichmentHandlercannot configuremax_batch_duration_secs, even though the downstream batching transform supports it.Code path: BigQueryEnrichmentHandler -> Enrichment -> RequestResponseIO -> BatchElements
Current behavior
max_batch_duration_secsis not available/configurable fromBigQueryEnrichmentHandlerand therefore is never forwarded toBatchElements.Expected behavior
BigQueryEnrichmentHandlershould optionally acceptmax_batch_duration_secsand pass it throughbatch_elements_kwargs()when batching is enabled.Proposed fix
max_batch_duration_secs: Optional[float] = NonetoBigQueryEnrichmentHandler.__init__.query_fnis not used, include it in_batching_kwargs(when provided).Additional note:
CloudSQLEnrichmentHandlerappears to have the same batching-kwargs limitation and may benefit from parity in a follow-up or same PR.Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components