airbyte-cdk 6.51.0.post4.dev15422454178__py3-none-any.whl → 6.51.0.post7.dev15491071971__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py +17 -6
- {airbyte_cdk-6.51.0.post4.dev15422454178.dist-info → airbyte_cdk-6.51.0.post7.dev15491071971.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.51.0.post4.dev15422454178.dist-info → airbyte_cdk-6.51.0.post7.dev15491071971.dist-info}/RECORD +7 -7
- {airbyte_cdk-6.51.0.post4.dev15422454178.dist-info → airbyte_cdk-6.51.0.post7.dev15491071971.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.51.0.post4.dev15422454178.dist-info → airbyte_cdk-6.51.0.post7.dev15491071971.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.51.0.post4.dev15422454178.dist-info → airbyte_cdk-6.51.0.post7.dev15491071971.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.51.0.post4.dev15422454178.dist-info → airbyte_cdk-6.51.0.post7.dev15491071971.dist-info}/entry_points.txt +0 -0
@@ -27,6 +27,7 @@ from airbyte_cdk.sources.streams.concurrent.state_converters.abstract_stream_sta
|
|
27
27
|
AbstractStreamStateConverter,
|
28
28
|
)
|
29
29
|
from airbyte_cdk.sources.types import Record, StreamSlice, StreamState
|
30
|
+
import gc
|
30
31
|
|
31
32
|
logger = logging.getLogger("airbyte")
|
32
33
|
|
@@ -59,8 +60,8 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
59
60
|
CurrentPerPartitionCursor expects the state of the ConcurrentCursor to follow the format {cursor_field: cursor_value}.
|
60
61
|
"""
|
61
62
|
|
62
|
-
DEFAULT_MAX_PARTITIONS_NUMBER =
|
63
|
-
SWITCH_TO_GLOBAL_LIMIT =
|
63
|
+
DEFAULT_MAX_PARTITIONS_NUMBER = 250
|
64
|
+
SWITCH_TO_GLOBAL_LIMIT = 100
|
64
65
|
_NO_STATE: Mapping[str, Any] = {}
|
65
66
|
_NO_CURSOR_STATE: Mapping[str, Any] = {}
|
66
67
|
_GLOBAL_STATE_KEY = "state"
|
@@ -179,6 +180,16 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
179
180
|
|
180
181
|
self._emit_state_message()
|
181
182
|
|
183
|
+
gc.collect()
|
184
|
+
alive = [o for o in gc.get_objects() if isinstance(o, ConcurrentCursor)]
|
185
|
+
print(f"ConcurrentCursor {len(alive)=}")
|
186
|
+
|
187
|
+
alive = [o for o in gc.get_objects() if isinstance(o, threading.Semaphore)]
|
188
|
+
print(f"Semaphores {len(alive)=}")
|
189
|
+
|
190
|
+
alive = [o for o in gc.get_objects() if isinstance(o, dict)]
|
191
|
+
print(f"Dictionaries {len(alive)=}")
|
192
|
+
|
182
193
|
def _check_and_update_parent_state(self) -> None:
|
183
194
|
last_closed_state = None
|
184
195
|
|
@@ -295,6 +306,7 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
295
306
|
):
|
296
307
|
self._partition_parent_state_map[partition_key] = (deepcopy(parent_state), seq)
|
297
308
|
|
309
|
+
# try:
|
298
310
|
for cursor_slice, is_last_slice, _ in iterate_with_last_flag_and_state(
|
299
311
|
cursor.stream_slices(),
|
300
312
|
lambda: None,
|
@@ -306,6 +318,7 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
306
318
|
partition=partition, cursor_slice=cursor_slice, extra_fields=partition.extra_fields
|
307
319
|
)
|
308
320
|
|
321
|
+
|
309
322
|
def _ensure_partition_limit(self) -> None:
|
310
323
|
"""
|
311
324
|
Ensure the maximum number of partitions does not exceed the predefined limit.
|
@@ -492,11 +505,10 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
492
505
|
def _create_cursor(
|
493
506
|
self, cursor_state: Any, runtime_lookback_window: int = 0
|
494
507
|
) -> ConcurrentCursor:
|
495
|
-
|
508
|
+
return self._cursor_factory.create(
|
496
509
|
stream_state=deepcopy(cursor_state),
|
497
510
|
runtime_lookback_window=timedelta(seconds=runtime_lookback_window),
|
498
511
|
)
|
499
|
-
return cursor
|
500
512
|
|
501
513
|
def should_be_synced(self, record: Record) -> bool:
|
502
514
|
return self._get_cursor(record).should_be_synced(record)
|
@@ -511,8 +523,7 @@ class ConcurrentPerPartitionCursor(Cursor):
|
|
511
523
|
raise ValueError(
|
512
524
|
"Invalid state as stream slices that are emitted should refer to an existing cursor"
|
513
525
|
)
|
514
|
-
|
515
|
-
return cursor
|
526
|
+
return self._cursor_per_partition[partition_key]
|
516
527
|
|
517
528
|
def limit_reached(self) -> bool:
|
518
529
|
return self._number_of_partitions > self.SWITCH_TO_GLOBAL_LIMIT
|
@@ -111,7 +111,7 @@ airbyte_cdk/sources/declarative/extractors/record_selector.py,sha256=vCpwX1PVRFP
|
|
111
111
|
airbyte_cdk/sources/declarative/extractors/response_to_file_extractor.py,sha256=WJyA2OYIEgFpVP5Y3o0tIj69AV6IKkn9B16MeXaEItI,6513
|
112
112
|
airbyte_cdk/sources/declarative/extractors/type_transformer.py,sha256=d6Y2Rfg8pMVEEnHllfVksWZdNVOU55yk34O03dP9muY,1626
|
113
113
|
airbyte_cdk/sources/declarative/incremental/__init__.py,sha256=U1oZKtBaEC6IACmvziY9Wzg7Z8EgF4ZuR7NwvjlB_Sk,1255
|
114
|
-
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=
|
114
|
+
airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=AjS24owY5oNP4Z6GbG7VlKIvKKlaf6IiFrQqoDZm6Xg,22988
|
115
115
|
airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py,sha256=Rbe6lJLTtZ5en33MwZiB9-H9-AwDMNHgwBZs8EqhYqk,22172
|
116
116
|
airbyte_cdk/sources/declarative/incremental/declarative_cursor.py,sha256=5Bhw9VRPyIuCaD0wmmq_L3DZsa-rJgtKSEUzSd8YYD0,536
|
117
117
|
airbyte_cdk/sources/declarative/incremental/global_substream_cursor.py,sha256=2tsE6FgXzemf4fZZ4uGtd8QpRBl9GJ2CRqSNJE5p0EI,16077
|
@@ -419,9 +419,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
419
419
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
420
420
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
421
421
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
422
|
-
airbyte_cdk-6.51.0.
|
423
|
-
airbyte_cdk-6.51.0.
|
424
|
-
airbyte_cdk-6.51.0.
|
425
|
-
airbyte_cdk-6.51.0.
|
426
|
-
airbyte_cdk-6.51.0.
|
427
|
-
airbyte_cdk-6.51.0.
|
422
|
+
airbyte_cdk-6.51.0.post7.dev15491071971.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
423
|
+
airbyte_cdk-6.51.0.post7.dev15491071971.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
424
|
+
airbyte_cdk-6.51.0.post7.dev15491071971.dist-info/METADATA,sha256=-XvLkJiVBp9lSHrOd6zCex0DmGuDxfPfv5N13J1mZpM,6364
|
425
|
+
airbyte_cdk-6.51.0.post7.dev15491071971.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
426
|
+
airbyte_cdk-6.51.0.post7.dev15491071971.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
|
427
|
+
airbyte_cdk-6.51.0.post7.dev15491071971.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|