airbyte-cdk 6.33.1.dev2__py3-none-any.whl → 6.33.2.dev0__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.
@@ -58,7 +58,8 @@ class ConcurrentPerPartitionCursor(Cursor):
58
58
  CurrentPerPartitionCursor expects the state of the ConcurrentCursor to follow the format {cursor_field: cursor_value}.
59
59
  """
60
60
 
61
- DEFAULT_MAX_PARTITIONS_NUMBER = 1000
61
+ DEFAULT_MAX_PARTITIONS_NUMBER = 10_000
62
+ SWITCH_TO_GLOBAL_LIMIT = 1000
62
63
  _NO_STATE: Mapping[str, Any] = {}
63
64
  _NO_CURSOR_STATE: Mapping[str, Any] = {}
64
65
  _GLOBAL_STATE_KEY = "state"
@@ -99,7 +100,7 @@ class ConcurrentPerPartitionCursor(Cursor):
99
100
  self._new_global_cursor: Optional[StreamState] = None
100
101
  self._lookback_window: int = 0
101
102
  self._parent_state: Optional[StreamState] = None
102
- self._over_limit: int = 0
103
+ self._number_of_partitions: int = 0
103
104
  self._use_global_cursor: bool = False
104
105
  self._partition_serializer = PerPartitionKeySerializer()
105
106
 
@@ -233,8 +234,8 @@ class ConcurrentPerPartitionCursor(Cursor):
233
234
  or removed due to being the oldest.
234
235
  """
235
236
  with self._lock:
237
+ self._number_of_partitions += 1
236
238
  while len(self._cursor_per_partition) > self.DEFAULT_MAX_PARTITIONS_NUMBER - 1:
237
- self._over_limit += 1
238
239
  # Try removing finished partitions first
239
240
  for partition_key in list(self._cursor_per_partition.keys()):
240
241
  if (
@@ -245,7 +246,7 @@ class ConcurrentPerPartitionCursor(Cursor):
245
246
  partition_key
246
247
  ) # Remove the oldest partition
247
248
  logger.warning(
248
- f"The maximum number of partitions has been reached. Dropping the oldest finished partition: {oldest_partition}. Over limit: {self._over_limit}."
249
+ f"The maximum number of partitions has been reached. Dropping the oldest finished partition: {oldest_partition}. Over limit: {self._number_of_partitions}."
249
250
  )
250
251
  break
251
252
  else:
@@ -254,7 +255,7 @@ class ConcurrentPerPartitionCursor(Cursor):
254
255
  1
255
256
  ] # Remove the oldest partition
256
257
  logger.warning(
257
- f"The maximum number of partitions has been reached. Dropping the oldest partition: {oldest_partition}. Over limit: {self._over_limit}."
258
+ f"The maximum number of partitions has been reached. Dropping the oldest partition: {oldest_partition}. Over limit: {self._number_of_partitions}."
258
259
  )
259
260
 
260
261
  def _set_initial_state(self, stream_state: StreamState) -> None:
@@ -355,6 +356,10 @@ class ConcurrentPerPartitionCursor(Cursor):
355
356
 
356
357
  def observe(self, record: Record) -> None:
357
358
  if not self._use_global_cursor and self.limit_reached():
359
+ logger.info(
360
+ f"Exceeded the 'SWITCH_TO_GLOBAL_LIMIT' of {self.SWITCH_TO_GLOBAL_LIMIT}. "
361
+ f"Switching to global cursor for {self._stream_name}."
362
+ )
358
363
  self._use_global_cursor = True
359
364
 
360
365
  if not record.associated_slice:
@@ -397,4 +402,4 @@ class ConcurrentPerPartitionCursor(Cursor):
397
402
  return cursor
398
403
 
399
404
  def limit_reached(self) -> bool:
400
- return self._over_limit > self.DEFAULT_MAX_PARTITIONS_NUMBER
405
+ return self._number_of_partitions > self.SWITCH_TO_GLOBAL_LIMIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.33.1.dev2
3
+ Version: 6.33.2.dev0
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -88,7 +88,7 @@ airbyte_cdk/sources/declarative/extractors/record_selector.py,sha256=tjNwcURmlyD
88
88
  airbyte_cdk/sources/declarative/extractors/response_to_file_extractor.py,sha256=LhqGDfX06_dDYLKsIVnwQ_nAWCln-v8PV7Wgt_QVeTI,6533
89
89
  airbyte_cdk/sources/declarative/extractors/type_transformer.py,sha256=d6Y2Rfg8pMVEEnHllfVksWZdNVOU55yk34O03dP9muY,1626
90
90
  airbyte_cdk/sources/declarative/incremental/__init__.py,sha256=U1oZKtBaEC6IACmvziY9Wzg7Z8EgF4ZuR7NwvjlB_Sk,1255
91
- airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=v59xLnzutVzIJNlJeIN36XLjkjuCSsnqfrmGKwQgbo4,17750
91
+ airbyte_cdk/sources/declarative/incremental/concurrent_partition_cursor.py,sha256=v2yeaGLHjvqar6aTvvAfrA70fMlvbgWwfyOnUowcoco,18027
92
92
  airbyte_cdk/sources/declarative/incremental/datetime_based_cursor.py,sha256=5Bl_2EeA4as0e3J23Yxp8Q8BXzh0nJ2NcGSgj3V0h2o,21954
93
93
  airbyte_cdk/sources/declarative/incremental/declarative_cursor.py,sha256=5Bhw9VRPyIuCaD0wmmq_L3DZsa-rJgtKSEUzSd8YYD0,536
94
94
  airbyte_cdk/sources/declarative/incremental/global_substream_cursor.py,sha256=9HO-QbL9akvjq2NP7l498RwLA4iQZlBMQW1tZbt34I8,15943
@@ -351,9 +351,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
351
351
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
352
352
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
353
353
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
354
- airbyte_cdk-6.33.1.dev2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
355
- airbyte_cdk-6.33.1.dev2.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
356
- airbyte_cdk-6.33.1.dev2.dist-info/METADATA,sha256=L-u-pUzrVa5OsU3lj_3B0JS7DiMHNd1QLAXoxCZirNM,6015
357
- airbyte_cdk-6.33.1.dev2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
- airbyte_cdk-6.33.1.dev2.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
359
- airbyte_cdk-6.33.1.dev2.dist-info/RECORD,,
354
+ airbyte_cdk-6.33.2.dev0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
355
+ airbyte_cdk-6.33.2.dev0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
356
+ airbyte_cdk-6.33.2.dev0.dist-info/METADATA,sha256=D76JImBuU8pyQqjCVzw_L8x6Uk4h2f7d6Dlr1slygRI,6015
357
+ airbyte_cdk-6.33.2.dev0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
+ airbyte_cdk-6.33.2.dev0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
359
+ airbyte_cdk-6.33.2.dev0.dist-info/RECORD,,