airbyte-cdk 7.3.9.post2.dev18667058048__py3-none-any.whl → 7.3.10.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.
@@ -96,13 +96,12 @@ class ConcurrentReadProcessor:
96
96
  """
97
97
  stream_name = partition.stream_name()
98
98
  self._streams_to_running_partitions[stream_name].add(partition)
99
- cursor = self._stream_name_to_instance[stream_name].cursor
100
99
  if self._slice_logger.should_log_slice_message(self._logger):
101
100
  self._message_repository.emit_message(
102
101
  self._slice_logger.create_slice_log_message(partition.to_slice())
103
102
  )
104
103
  self._thread_pool_manager.submit(
105
- self._partition_reader.process_partition, partition, cursor
104
+ self._partition_reader.process_partition, partition
106
105
  )
107
106
 
108
107
  def on_partition_complete_sentinel(
@@ -116,16 +115,26 @@ class ConcurrentReadProcessor:
116
115
  """
117
116
  partition = sentinel.partition
118
117
 
119
- partitions_running = self._streams_to_running_partitions[partition.stream_name()]
120
- if partition in partitions_running:
121
- partitions_running.remove(partition)
122
- # If all partitions were generated and this was the last one, the stream is done
123
- if (
124
- partition.stream_name() not in self._streams_currently_generating_partitions
125
- and len(partitions_running) == 0
126
- ):
127
- yield from self._on_stream_is_done(partition.stream_name())
128
- yield from self._message_repository.consume_queue()
118
+ try:
119
+ if sentinel.is_successful:
120
+ stream = self._stream_name_to_instance[partition.stream_name()]
121
+ stream.cursor.close_partition(partition)
122
+ except Exception as exception:
123
+ self._flag_exception(partition.stream_name(), exception)
124
+ yield AirbyteTracedException.from_exception(
125
+ exception, stream_descriptor=StreamDescriptor(name=partition.stream_name())
126
+ ).as_sanitized_airbyte_message()
127
+ finally:
128
+ partitions_running = self._streams_to_running_partitions[partition.stream_name()]
129
+ if partition in partitions_running:
130
+ partitions_running.remove(partition)
131
+ # If all partitions were generated and this was the last one, the stream is done
132
+ if (
133
+ partition.stream_name() not in self._streams_currently_generating_partitions
134
+ and len(partitions_running) == 0
135
+ ):
136
+ yield from self._on_stream_is_done(partition.stream_name())
137
+ yield from self._message_repository.consume_queue()
129
138
 
130
139
  def on_record(self, record: Record) -> Iterable[AirbyteMessage]:
131
140
  """
@@ -154,6 +163,7 @@ class ConcurrentReadProcessor:
154
163
  stream.as_airbyte_stream(), AirbyteStreamStatus.RUNNING
155
164
  )
156
165
  self._record_counter[stream.name] += 1
166
+ stream.cursor.observe(record)
157
167
  yield message
158
168
  yield from self._message_repository.consume_queue()
159
169
 
@@ -198,7 +198,7 @@ class ConcurrentCursor(Cursor):
198
198
  # not thread safe. When multiple partitions are being closed by the cursor at the same time, it is
199
199
  # possible for one partition to update concurrent_state after a second partition has already read
200
200
  # the previous state. This can lead to the second partition overwriting the previous one's state.
201
- self._lock = threading.Lock()
201
+ # self._lock = threading.Lock()
202
202
 
203
203
  @property
204
204
  def state(self) -> MutableMapping[str, Any]:
@@ -273,14 +273,14 @@ class ConcurrentCursor(Cursor):
273
273
  return self._connector_state_converter.parse_value(self._cursor_field.extract_value(record))
274
274
 
275
275
  def close_partition(self, partition: Partition) -> None:
276
- with self._lock:
277
- slice_count_before = len(self._concurrent_state.get("slices", []))
278
- self._add_slice_to_state(partition)
279
- if slice_count_before < len(
280
- self._concurrent_state["slices"]
281
- ): # only emit if at least one slice has been processed
282
- self._merge_partitions()
283
- self._emit_state_message()
276
+ #with self._lock:
277
+ slice_count_before = len(self._concurrent_state.get("slices", []))
278
+ self._add_slice_to_state(partition)
279
+ if slice_count_before < len(
280
+ self._concurrent_state["slices"]
281
+ ): # only emit if at least one slice has been processed
282
+ self._merge_partitions()
283
+ self._emit_state_message()
284
284
  self._has_closed_at_least_one_slice = True
285
285
 
286
286
  def _add_slice_to_state(self, partition: Partition) -> None:
@@ -60,7 +60,7 @@ class PartitionReader:
60
60
  self._queue = queue
61
61
  self._partition_logger = partition_logger
62
62
 
63
- def process_partition(self, partition: Partition, cursor: Cursor) -> None:
63
+ def process_partition(self, partition: Partition) -> None:
64
64
  """
65
65
  Process a partition and put the records in the output queue.
66
66
  When all the partitions are added to the queue, a sentinel is added to the queue to indicate that all the partitions have been generated.
@@ -78,8 +78,6 @@ class PartitionReader:
78
78
 
79
79
  for record in partition.read():
80
80
  self._queue.put(record)
81
- cursor.observe(record)
82
- cursor.close_partition(partition)
83
81
  self._queue.put(PartitionCompleteSentinel(partition, self._IS_SUCCESSFUL))
84
82
  except Exception as e:
85
83
  self._queue.put(StreamThreadException(e, partition.stream_name()))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 7.3.9.post2.dev18667058048
3
+ Version: 7.3.10.dev0
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -97,7 +97,7 @@ airbyte_cdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
97
97
  airbyte_cdk/sources/__init__.py,sha256=45J83QsFH3Wky3sVapZWg4C58R_i1thm61M06t2c1AQ,1156
98
98
  airbyte_cdk/sources/abstract_source.py,sha256=50vxEBRByiNhT4WJkiFvgM-C6PWqKSJgvuNC_aeg2cw,15547
99
99
  airbyte_cdk/sources/concurrent_source/__init__.py,sha256=3D_RJsxQfiLboSCDdNei1Iv-msRp3DXsas6E9kl7dXc,386
100
- airbyte_cdk/sources/concurrent_source/concurrent_read_processor.py,sha256=qUi9zRjSEOsu3k6niRFjVn4l29OOMZVstIUoqNLw4_k,12208
100
+ airbyte_cdk/sources/concurrent_source/concurrent_read_processor.py,sha256=DPNp3Nh1h_sarXybVMuiIjwlJcIbz0_xAq1sc7mhZvM,12723
101
101
  airbyte_cdk/sources/concurrent_source/concurrent_source.py,sha256=2sdgOnWtvClZaibnfn4Yardv2Jjv_lfwMubublDl1ZY,8458
102
102
  airbyte_cdk/sources/concurrent_source/concurrent_source_adapter.py,sha256=f9PIRPWn2tXu0-bxVeYHL2vYdqCzZ_kgpHg5_Ep-cfQ,6103
103
103
  airbyte_cdk/sources/concurrent_source/partition_generation_completed_sentinel.py,sha256=z1t-rAZBsqVidv2fpUlPHE9JgyXsITuGk4AMu96mXSQ,696
@@ -353,13 +353,13 @@ airbyte_cdk/sources/streams/concurrent/abstract_stream_facade.py,sha256=QTry1QCB
353
353
  airbyte_cdk/sources/streams/concurrent/adapters.py,sha256=h4ZewhWn2PzPTt0lZZjcUL4rrpW9E_of7prnI3bm-c4,14004
354
354
  airbyte_cdk/sources/streams/concurrent/availability_strategy.py,sha256=M0XmvF3vjlr4GbCM0XH1hAj7udiAONM9SnmXjqufzLM,1035
355
355
  airbyte_cdk/sources/streams/concurrent/clamping.py,sha256=i26GVyui2ScEXSP-IP_61K2HaTp1-6lTlYHsZVYpuZA,3240
356
- airbyte_cdk/sources/streams/concurrent/cursor.py,sha256=oEcqUyswPyOg6SnjrFr8c8YYxVvaaInWNCHRLQcKjmk,25713
356
+ airbyte_cdk/sources/streams/concurrent/cursor.py,sha256=WAJAft9GSliVXWOQVjK4Aya5FdunjoFz5j0Km5l2MDY,25688
357
357
  airbyte_cdk/sources/streams/concurrent/cursor_types.py,sha256=ZyWLPpeLX1qXcP5MwS-wxK11IBMsnVPCw9zx8gA2_Ro,843
358
358
  airbyte_cdk/sources/streams/concurrent/default_stream.py,sha256=SSufbo5f7OOYS8DZaABXeJVvodcfp9wb8J9lT5Xik3s,4744
359
359
  airbyte_cdk/sources/streams/concurrent/exceptions.py,sha256=JOZ446MCLpmF26r9KfS6OO_6rGjcjgJNZdcw6jccjEI,468
360
360
  airbyte_cdk/sources/streams/concurrent/helpers.py,sha256=S6AW8TgIASCZ2UuUcQLE8OzgYUHWt2-KPOvNPwnQf-Q,1596
361
361
  airbyte_cdk/sources/streams/concurrent/partition_enqueuer.py,sha256=2t64b_z9cEPmlHZnjSiMTO8PEtEdiAJDG0JcYOtUqAE,3363
362
- airbyte_cdk/sources/streams/concurrent/partition_reader.py,sha256=qKd1NBlAjwo4mRVq9bowWr7oYg8SpgISklpkjUkie4k,3434
362
+ airbyte_cdk/sources/streams/concurrent/partition_reader.py,sha256=b8gTenOot1Yg5aer70onNLyCk43nlBZtBvBRKjW8VHs,3333
363
363
  airbyte_cdk/sources/streams/concurrent/partitions/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
364
364
  airbyte_cdk/sources/streams/concurrent/partitions/partition.py,sha256=CmaRcKn8y118No3qvbRV9DBeAUKv17lrVgloR4Y9TwU,1490
365
365
  airbyte_cdk/sources/streams/concurrent/partitions/partition_generator.py,sha256=_ymkkBr71_qt1fW0_MUqw96OfNBkeJngXQ09yolEDHw,441
@@ -459,9 +459,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
459
459
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=9YDJmnIGFsT51CVQf2tSSvTapGimITjEFGbUTSZAGTI,963
460
460
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
461
461
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
462
- airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
463
- airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
464
- airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/METADATA,sha256=qXNgvIOFA63FeGgWN7HJ-e0SfQA9if25LIFffhynZOM,6780
465
- airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
466
- airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
467
- airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/RECORD,,
462
+ airbyte_cdk-7.3.10.dev0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
463
+ airbyte_cdk-7.3.10.dev0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
464
+ airbyte_cdk-7.3.10.dev0.dist-info/METADATA,sha256=NOmBy-jxE-RCgk5KiN_Tg-3pDHgrKUaBQwnxlNRevos,6765
465
+ airbyte_cdk-7.3.10.dev0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
466
+ airbyte_cdk-7.3.10.dev0.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
467
+ airbyte_cdk-7.3.10.dev0.dist-info/RECORD,,