Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class PostProcessor(beam.DoFn):
Return filename, prediction and the model id used to perform the
prediction
"""
def process(self, element: tuple[str, PredictionResult]) -> Iterable[str]:
def process(self, element: tuple[str, PredictionResult]) -> Iterable[Any]:
filename, prediction_result = element
prediction = torch.argmax(prediction_result.inference, dim=0)
yield filename, prediction, prediction_result.model_id
Expand Down
10 changes: 7 additions & 3 deletions sdks/python/apache_beam/io/gcp/bigquery_change_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ def _emit_query_ranges(
self,
start_ts: Timestamp,
end_ts: Timestamp,
watermark_estimator: _PollWatermarkEstimator) -> Iterable[_QueryRange]:
watermark_estimator: _PollWatermarkEstimator
) -> Iterable[TimestampedValue[_QueryRange]]:
"""Compute and yield _QueryRange elements, advancing estimator state."""
ranges = compute_ranges(start_ts, end_ts, self._change_function)
_LOGGER.info(
Expand Down Expand Up @@ -524,7 +525,7 @@ def process(
restriction_tracker=beam.DoFn.RestrictionParam(),
watermark_estimator=beam.DoFn.WatermarkEstimatorParam(
_PollWatermarkEstimatorProvider())
) -> Iterable[_QueryRange]:
) -> Iterable[TimestampedValue[_QueryRange]]:

now = time.time()
start_ts = watermark_estimator.poll_cursor()
Expand Down Expand Up @@ -1031,7 +1032,10 @@ class _DecompressArrowBatchesFn(beam.DoFn):
def __init__(self, change_timestamp_column: str = 'change_timestamp') -> None:
self._change_timestamp_column = change_timestamp_column

def process(self, element: tuple[bytes, bytes]) -> Iterable[dict[str, Any]]:
def process(
self,
element: tuple[bytes,
bytes]) -> Iterable[TimestampedValue[dict[str, Any]]]:
schema_bytes, batch_bytes = element
schema = pyarrow.ipc.read_schema(pyarrow.py_buffer(schema_bytes))
batch = pyarrow.ipc.read_record_batch(
Expand Down
1 change: 0 additions & 1 deletion sdks/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,4 @@ invalid-argument = "ignore"
invalid-inheritance = "ignore"
not-iterable = "ignore"
unexpected-keyword = "ignore"
invalid-yield = "ignore"
bad-typed-dict-key = "ignore"
Loading