port-ocean 0.24.2__py3-none-any.whl → 0.24.3__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.
Potentially problematic release.
This version of port-ocean might be problematic. Click here for more details.
- port_ocean/clients/port/mixins/entities.py +50 -56
- port_ocean/config/settings.py +0 -1
- port_ocean/tests/core/handlers/mixins/test_sync_raw.py +0 -3
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.3.dist-info}/METADATA +1 -1
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.3.dist-info}/RECORD +8 -8
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.3.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.3.dist-info}/WHEEL +0 -0
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.3.dist-info}/entry_points.txt +0 -0
|
@@ -353,66 +353,60 @@ class EntityClientMixin:
|
|
|
353
353
|
entities_results: list[tuple[bool, Entity]] = []
|
|
354
354
|
blueprint = entities[0].blueprint
|
|
355
355
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
)
|
|
356
|
+
bulk_size = self.calculate_entities_batch_size(entities)
|
|
357
|
+
bulks = [
|
|
358
|
+
entities[i : i + bulk_size] for i in range(0, len(entities), bulk_size)
|
|
359
|
+
]
|
|
360
|
+
|
|
361
|
+
bulk_results = await asyncio.gather(
|
|
362
|
+
*(
|
|
363
|
+
self.upsert_entities_bulk(
|
|
364
|
+
blueprint,
|
|
365
|
+
bulk,
|
|
366
|
+
request_options,
|
|
367
|
+
user_agent_type,
|
|
368
|
+
should_raise=should_raise,
|
|
369
|
+
)
|
|
370
|
+
for bulk in bulks
|
|
371
|
+
),
|
|
372
|
+
return_exceptions=True,
|
|
373
|
+
)
|
|
375
374
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
for bulk, bulk_result in zip(bulks, bulk_results):
|
|
376
|
+
if isinstance(bulk_result, httpx.HTTPStatusError) or isinstance(
|
|
377
|
+
bulk_result, Exception
|
|
378
|
+
):
|
|
379
|
+
if should_raise:
|
|
380
|
+
raise bulk_result
|
|
381
|
+
# If should_raise is False, retry batch in sequential order as a fallback only for 413 errors
|
|
382
|
+
if (
|
|
383
|
+
isinstance(bulk_result, httpx.HTTPStatusError)
|
|
384
|
+
and bulk_result.response.status_code == 413
|
|
379
385
|
):
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
386
|
+
individual_upsert_results = (
|
|
387
|
+
await self._upsert_entities_batch_individually(
|
|
388
|
+
bulk, request_options, user_agent_type, should_raise
|
|
389
|
+
)
|
|
390
|
+
)
|
|
391
|
+
entities_results.extend(individual_upsert_results)
|
|
392
|
+
else:
|
|
393
|
+
# For other errors, mark all entities in the batch as failed
|
|
394
|
+
for entity in bulk:
|
|
395
|
+
failed_result: tuple[bool, Entity] = (
|
|
396
|
+
False,
|
|
397
|
+
self._reduce_entity(entity),
|
|
398
|
+
)
|
|
399
|
+
entities_results.append(failed_result)
|
|
400
|
+
elif isinstance(bulk_result, list):
|
|
401
|
+
for status, entity in bulk_result:
|
|
383
402
|
if (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
bulk, request_options, user_agent_type, should_raise
|
|
390
|
-
)
|
|
403
|
+
status is not None
|
|
404
|
+
): # when using the search identifier we might not have an actual identifier
|
|
405
|
+
bulk_result_tuple: tuple[bool, Entity] = (
|
|
406
|
+
bool(status),
|
|
407
|
+
entity,
|
|
391
408
|
)
|
|
392
|
-
entities_results.
|
|
393
|
-
else:
|
|
394
|
-
# For other errors, mark all entities in the batch as failed
|
|
395
|
-
for entity in bulk:
|
|
396
|
-
failed_result: tuple[bool, Entity] = (
|
|
397
|
-
False,
|
|
398
|
-
self._reduce_entity(entity),
|
|
399
|
-
)
|
|
400
|
-
entities_results.append(failed_result)
|
|
401
|
-
elif isinstance(bulk_result, list):
|
|
402
|
-
for status, entity in bulk_result:
|
|
403
|
-
if (
|
|
404
|
-
status is not None
|
|
405
|
-
): # when using the search identifier we might not have an actual identifier
|
|
406
|
-
bulk_result_tuple: tuple[bool, Entity] = (
|
|
407
|
-
bool(status),
|
|
408
|
-
entity,
|
|
409
|
-
)
|
|
410
|
-
entities_results.append(bulk_result_tuple)
|
|
411
|
-
else:
|
|
412
|
-
individual_upsert_results = await self._upsert_entities_batch_individually(
|
|
413
|
-
entities, request_options, user_agent_type, should_raise
|
|
414
|
-
)
|
|
415
|
-
entities_results.extend(individual_upsert_results)
|
|
409
|
+
entities_results.append(bulk_result_tuple)
|
|
416
410
|
|
|
417
411
|
return entities_results
|
|
418
412
|
|
port_ocean/config/settings.py
CHANGED
|
@@ -108,7 +108,6 @@ class IntegrationConfiguration(BaseOceanSettings, extra=Extra.allow):
|
|
|
108
108
|
|
|
109
109
|
upsert_entities_batch_max_length: int = 20
|
|
110
110
|
upsert_entities_batch_max_size_in_bytes: int = 1024 * 1024
|
|
111
|
-
bulk_upserts_enabled: bool = False
|
|
112
111
|
|
|
113
112
|
@validator("process_execution_mode")
|
|
114
113
|
def validate_process_execution_mode(
|
|
@@ -98,7 +98,6 @@ async def test_sync_raw_mixin_self_dependency(
|
|
|
98
98
|
) -> None:
|
|
99
99
|
mock_ocean.config.upsert_entities_batch_max_length = 20
|
|
100
100
|
mock_ocean.config.upsert_entities_batch_max_size_in_bytes = 1024 * 1024
|
|
101
|
-
mock_ocean.config.bulk_upserts_enabled = True
|
|
102
101
|
|
|
103
102
|
entities_params = [
|
|
104
103
|
("entity_1", "service", {"service": "entity_1"}, True),
|
|
@@ -219,7 +218,6 @@ async def test_sync_raw_mixin_circular_dependency(
|
|
|
219
218
|
) -> None:
|
|
220
219
|
mock_ocean.config.upsert_entities_batch_max_length = 20
|
|
221
220
|
mock_ocean.config.upsert_entities_batch_max_size_in_bytes = 1024 * 1024
|
|
222
|
-
mock_ocean.config.bulk_upserts_enabled = True
|
|
223
221
|
|
|
224
222
|
entities_params = [
|
|
225
223
|
("entity_1", "service", {"service": "entity_2"}, True),
|
|
@@ -359,7 +357,6 @@ async def test_sync_raw_mixin_dependency(
|
|
|
359
357
|
) -> None:
|
|
360
358
|
mock_ocean.config.upsert_entities_batch_max_length = 20
|
|
361
359
|
mock_ocean.config.upsert_entities_batch_max_size_in_bytes = 1024 * 1024
|
|
362
|
-
mock_ocean.config.bulk_upserts_enabled = True
|
|
363
360
|
|
|
364
361
|
entities_params = [
|
|
365
362
|
("entity_1", "service", {"service": "entity_3"}, True),
|
|
@@ -59,7 +59,7 @@ port_ocean/clients/port/authentication.py,sha256=r7r8Ag9WuwXy-CmgeOoj-PHbmJAQxhb
|
|
|
59
59
|
port_ocean/clients/port/client.py,sha256=dv0mxIOde6J-wFi1FXXZkoNPVHrZzY7RSMhNkDD9xgA,3566
|
|
60
60
|
port_ocean/clients/port/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
61
|
port_ocean/clients/port/mixins/blueprints.py,sha256=aMCG4zePsMSMjMLiGrU37h5z5_ElfMzTcTvqvOI5wXY,4683
|
|
62
|
-
port_ocean/clients/port/mixins/entities.py,sha256=
|
|
62
|
+
port_ocean/clients/port/mixins/entities.py,sha256=hg4xJCcYml2JLkqEwg7lJUhB5YLm_sadNfiKdf3rP6Q,22811
|
|
63
63
|
port_ocean/clients/port/mixins/integrations.py,sha256=s6paomK9bYWW-Tu3y2OIaEGSxsXCHyhapVi4JIhhO64,11162
|
|
64
64
|
port_ocean/clients/port/mixins/migrations.py,sha256=vdL_A_NNUogvzujyaRLIoZEu5vmKDY2BxTjoGP94YzI,1467
|
|
65
65
|
port_ocean/clients/port/mixins/organization.py,sha256=A2cP5V49KnjoAXxjmnm_XGth4ftPSU0qURNfnyUyS_Y,1041
|
|
@@ -69,7 +69,7 @@ port_ocean/clients/port/utils.py,sha256=osFyAjw7Y5Qf2uVSqC7_RTCQfijiL1zS74JJM0go
|
|
|
69
69
|
port_ocean/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
70
|
port_ocean/config/base.py,sha256=x1gFbzujrxn7EJudRT81C6eN9WsYAb3vOHwcpcpX8Tc,6370
|
|
71
71
|
port_ocean/config/dynamic.py,sha256=T0AWE41tjp9fL1sgrTRwNAGlPw6xiakFp-KXWvHtu_4,2035
|
|
72
|
-
port_ocean/config/settings.py,sha256=
|
|
72
|
+
port_ocean/config/settings.py,sha256=R4Ju15XKbwQEg2W7uUCxoj4_9gUS9uYUFQnX-FUNRDI,7156
|
|
73
73
|
port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
74
|
port_ocean/consumers/kafka_consumer.py,sha256=N8KocjBi9aR0BOPG8hgKovg-ns_ggpEjrSxqSqF_BSo,4710
|
|
75
75
|
port_ocean/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -166,7 +166,7 @@ port_ocean/tests/core/defaults/test_common.py,sha256=sR7RqB3ZYV6Xn6NIg-c8k5K6JcG
|
|
|
166
166
|
port_ocean/tests/core/handlers/entities_state_applier/test_applier.py,sha256=eJYXc7AwrV0XRS6HpixwzghjB3pspT5Gxr9twvJE7fk,8290
|
|
167
167
|
port_ocean/tests/core/handlers/entity_processor/test_jq_entity_processor.py,sha256=8WpMn559Mf0TFWmloRpZrVgr6yWwyA0C4n2lVHCtyq4,13596
|
|
168
168
|
port_ocean/tests/core/handlers/mixins/test_live_events.py,sha256=iAwVpr3n3PIkXQLw7hxd-iB_SR_vyfletVXJLOmyz28,12480
|
|
169
|
-
port_ocean/tests/core/handlers/mixins/test_sync_raw.py,sha256
|
|
169
|
+
port_ocean/tests/core/handlers/mixins/test_sync_raw.py,sha256=-05ec3gRsmnMgmqzkIRjpm_yMdRZc3O3Br3RLFW2Kjw,44297
|
|
170
170
|
port_ocean/tests/core/handlers/port_app_config/test_api.py,sha256=eJZ6SuFBLz71y4ca3DNqKag6d6HUjNJS0aqQPwiLMTI,1999
|
|
171
171
|
port_ocean/tests/core/handlers/port_app_config/test_base.py,sha256=hSh556bJM9zuELwhwnyKSfd9z06WqWXIfe-6hCl5iKI,9799
|
|
172
172
|
port_ocean/tests/core/handlers/queue/test_local_queue.py,sha256=9Ly0HzZXbs6Rbl_bstsIdInC3h2bgABU3roP9S_PnJM,2582
|
|
@@ -200,8 +200,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
|
|
|
200
200
|
port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
|
|
201
201
|
port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
|
|
202
202
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
|
203
|
-
port_ocean-0.24.
|
|
204
|
-
port_ocean-0.24.
|
|
205
|
-
port_ocean-0.24.
|
|
206
|
-
port_ocean-0.24.
|
|
207
|
-
port_ocean-0.24.
|
|
203
|
+
port_ocean-0.24.3.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
204
|
+
port_ocean-0.24.3.dist-info/METADATA,sha256=sW3iuoz4mGPzlq-YjjeF1hMaqIpjO-sGB2iaSx2AYRg,6764
|
|
205
|
+
port_ocean-0.24.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
206
|
+
port_ocean-0.24.3.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
207
|
+
port_ocean-0.24.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|