Skip to content

Commit 0a4af76

Browse files
authored
Merge pull request #402 from nodestream-proj/concurrent-transformer-bugfix
fix: ConcurrentTransformer missing arg
2 parents 2975ce1 + 6c6d070 commit 0a4af76

File tree

4 files changed

+608
-408
lines changed

4 files changed

+608
-408
lines changed

nodestream/pipeline/transformers/transformer.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from abc import abstractmethod
2+
from abc import ABC, abstractmethod
33
from concurrent.futures import ThreadPoolExecutor
44
from logging import getLogger
55
from typing import Any, AsyncGenerator, Dict, Optional
@@ -34,7 +34,7 @@ async def transform_record(self, record: Any) -> Any:
3434
raise NotImplementedError
3535

3636

37-
class ConcurrentTransformer(Transformer):
37+
class ConcurrentTransformer(Transformer, ABC):
3838
"""A `ConcurrentTransformer` can process multiple records concurrently.
3939
4040
`ConcurrentTransformer`s are useful when the transformation work is IO
@@ -60,7 +60,7 @@ def __init__(
6060
self.pending_tasks = []
6161

6262
def on_worker_thread_start(self):
63-
pass
63+
pass # do nothing
6464

6565
async def drain_completed_tasks(self):
6666
tasks_drained = 0
@@ -107,7 +107,7 @@ def do_work_on_record(self, record: Any) -> Any:
107107
async def yield_processor(self):
108108
await asyncio.sleep(0)
109109

110-
async def emit_outstanding_records(self):
110+
async def emit_outstanding_records(self, context: StepContext):
111111
while self.pending_tasks:
112112
async for result in self.drain_completed_tasks():
113113
yield result

0 commit comments

Comments
 (0)