port-ocean 0.24.2__py3-none-any.whl → 0.24.4__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/core/integrations/mixins/sync_raw.py +7 -6
- port_ocean/core/integrations/mixins/utils.py +6 -1
- port_ocean/helpers/metric/metric.py +1 -0
- port_ocean/tests/core/handlers/mixins/test_sync_raw.py +0 -3
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.4.dist-info}/METADATA +1 -1
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.4.dist-info}/RECORD +11 -11
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.4.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.4.dist-info}/WHEEL +0 -0
- {port_ocean-0.24.2.dist-info → port_ocean-0.24.4.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(
|
|
@@ -233,6 +233,13 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
233
233
|
objects_diff = await self._calculate_raw(
|
|
234
234
|
[(resource, results)], parse_all, send_raw_data_examples_amount
|
|
235
235
|
)
|
|
236
|
+
|
|
237
|
+
ocean.metrics.inc_metric(
|
|
238
|
+
name=MetricType.OBJECT_COUNT_NAME,
|
|
239
|
+
labels=[ocean.metrics.current_resource_kind(), MetricPhase.TRANSFORM, MetricPhase.TransformResult.FAILED],
|
|
240
|
+
value=len(objects_diff[0].entity_selector_diff.failed)
|
|
241
|
+
)
|
|
242
|
+
|
|
236
243
|
modified_objects = []
|
|
237
244
|
|
|
238
245
|
if event.event_type == EventType.RESYNC:
|
|
@@ -395,12 +402,6 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
395
402
|
value=number_of_raw_results -number_of_transformed_entities
|
|
396
403
|
)
|
|
397
404
|
|
|
398
|
-
ocean.metrics.inc_metric(
|
|
399
|
-
name=MetricType.OBJECT_COUNT_NAME,
|
|
400
|
-
labels=[ocean.metrics.current_resource_kind(), MetricPhase.TRANSFORM , MetricPhase.TransformResult.FAILED],
|
|
401
|
-
value=len(errors)
|
|
402
|
-
)
|
|
403
|
-
|
|
404
405
|
return passed_entities, errors
|
|
405
406
|
|
|
406
407
|
async def register_raw(
|
|
@@ -21,7 +21,7 @@ from port_ocean.exceptions.core import (
|
|
|
21
21
|
|
|
22
22
|
from port_ocean.utils.async_http import _http_client
|
|
23
23
|
from port_ocean.clients.port.utils import _http_client as _port_http_client
|
|
24
|
-
|
|
24
|
+
from port_ocean.helpers.metric.metric import MetricType, MetricPhase
|
|
25
25
|
from port_ocean.context.ocean import ocean
|
|
26
26
|
|
|
27
27
|
@contextmanager
|
|
@@ -61,6 +61,11 @@ async def resync_generator_wrapper(
|
|
|
61
61
|
yield validate_result(result)
|
|
62
62
|
except OceanAbortException as error:
|
|
63
63
|
errors.append(error)
|
|
64
|
+
ocean.metrics.inc_metric(
|
|
65
|
+
name=MetricType.OBJECT_COUNT_NAME,
|
|
66
|
+
labels=[ocean.metrics.current_resource_kind(), MetricPhase.EXTRACT , MetricPhase.ExtractResult.FAILED],
|
|
67
|
+
value=1
|
|
68
|
+
)
|
|
64
69
|
except StopAsyncIteration:
|
|
65
70
|
if errors:
|
|
66
71
|
raise ExceptionGroup(
|
|
@@ -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
|
|
@@ -121,8 +121,8 @@ port_ocean/core/integrations/mixins/events.py,sha256=2L7P3Jhp8XBqddh2_o9Cn4N261n
|
|
|
121
121
|
port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
|
|
122
122
|
port_ocean/core/integrations/mixins/live_events.py,sha256=8HklZmlyffYY_LeDe8xbt3Tb08rlLkqVhFF-2NQeJP4,4126
|
|
123
123
|
port_ocean/core/integrations/mixins/sync.py,sha256=Vm_898pLKBwfVewtwouDWsXoxcOLicnAy6pzyqqk6U8,4053
|
|
124
|
-
port_ocean/core/integrations/mixins/sync_raw.py,sha256=
|
|
125
|
-
port_ocean/core/integrations/mixins/utils.py,sha256=
|
|
124
|
+
port_ocean/core/integrations/mixins/sync_raw.py,sha256=XCi6GoKgSFZjgx-pcQ7niDE0bQS-gwu4bCyqUbYqtiM,34158
|
|
125
|
+
port_ocean/core/integrations/mixins/utils.py,sha256=N76dNu1Y6UEg0_pcSdF4RO6dQIZ8EBfX3xMelgWdMxM,3779
|
|
126
126
|
port_ocean/core/models.py,sha256=NYsOBtAqRgmRTb2XYGDW31IxTHSXGRQLOF64apwUZ2Q,2872
|
|
127
127
|
port_ocean/core/ocean_types.py,sha256=4VipWFOHEh_d9LmWewQccwx1p2dtrRYW0YURVgNsAjo,1398
|
|
128
128
|
port_ocean/core/utils/entity_topological_sorter.py,sha256=MDUjM6OuDy4Xj68o-7InNN0w1jqjxeDfeY8U02vySNI,3081
|
|
@@ -139,7 +139,7 @@ port_ocean/exceptions/utils.py,sha256=gjOqpi-HpY1l4WlMFsGA9yzhxDhajhoGGdDDyGbLnq
|
|
|
139
139
|
port_ocean/exceptions/webhook_processor.py,sha256=yQYazg53Y-ohb7HfViwq1opH_ZUuUdhHSRxcUNveFpI,114
|
|
140
140
|
port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
141
141
|
port_ocean/helpers/async_client.py,sha256=SRlP6o7_FCSY3UHnRlZdezppePVxxOzZ0z861vE3K40,1783
|
|
142
|
-
port_ocean/helpers/metric/metric.py,sha256=
|
|
142
|
+
port_ocean/helpers/metric/metric.py,sha256=Aacz7bOd8ZCwEPpXAdwLbKRXf28Z4wiViG_GXiV_xWg,14529
|
|
143
143
|
port_ocean/helpers/metric/utils.py,sha256=1lAgrxnZLuR_wUNDyPOPzLrm32b8cDdioob2lvnPQ1A,1619
|
|
144
144
|
port_ocean/helpers/retry.py,sha256=gmS4YxM6N4fboFp7GSgtOzyBJemxs46bnrz4L4rDS6Y,16136
|
|
145
145
|
port_ocean/log/__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.4.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
204
|
+
port_ocean-0.24.4.dist-info/METADATA,sha256=qlhSoMjy8yHoOBUz5-5MRml0HTjQDh8wKFMyatE3nXs,6764
|
|
205
|
+
port_ocean-0.24.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
206
|
+
port_ocean-0.24.4.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
207
|
+
port_ocean-0.24.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|