port-ocean 0.12.2.dev4__py3-none-any.whl → 0.12.2.dev6__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/core/integrations/mixins/sync_raw.py +51 -50
- {port_ocean-0.12.2.dev4.dist-info → port_ocean-0.12.2.dev6.dist-info}/METADATA +1 -1
- {port_ocean-0.12.2.dev4.dist-info → port_ocean-0.12.2.dev6.dist-info}/RECORD +6 -6
- {port_ocean-0.12.2.dev4.dist-info → port_ocean-0.12.2.dev6.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.12.2.dev4.dist-info → port_ocean-0.12.2.dev6.dist-info}/WHEEL +0 -0
- {port_ocean-0.12.2.dev4.dist-info → port_ocean-0.12.2.dev6.dist-info}/entry_points.txt +0 -0
|
@@ -3,6 +3,7 @@ import inspect
|
|
|
3
3
|
import typing
|
|
4
4
|
from typing import Callable, Awaitable, Any
|
|
5
5
|
|
|
6
|
+
import httpx
|
|
6
7
|
from loguru import logger
|
|
7
8
|
|
|
8
9
|
from port_ocean.clients.port.types import UserAgentType
|
|
@@ -139,9 +140,9 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
139
140
|
objects_diff = await self._calculate_raw(
|
|
140
141
|
[(resource, results)], parse_all, send_raw_data_examples_amount
|
|
141
142
|
)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
await self.entities_state_applier.upsert(
|
|
144
|
+
objects_diff[0].entity_selector_diff.passed, user_agent_type
|
|
145
|
+
)
|
|
145
146
|
return CalculationResult(
|
|
146
147
|
objects_diff[0].entity_selector_diff._replace(passed=objects_diff[0].entity_selector_diff.passed),
|
|
147
148
|
errors=objects_diff[0].errors,
|
|
@@ -425,20 +426,20 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
425
426
|
use_cache=False
|
|
426
427
|
)
|
|
427
428
|
logger.info(f"Resync will use the following mappings: {app_config.dict()}")
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
429
|
+
try:
|
|
430
|
+
did_fetched_current_state = True
|
|
431
|
+
entities_at_port = await ocean.port_client.search_entities(
|
|
432
|
+
user_agent_type
|
|
433
|
+
)
|
|
434
|
+
except httpx.HTTPError as e:
|
|
435
|
+
logger.warning(
|
|
436
|
+
"Failed to fetch the current state of entities at Port. "
|
|
437
|
+
"Skipping delete phase due to unknown initial state. "
|
|
438
|
+
f"Error: {e}\n"
|
|
439
|
+
f"Response status code: {e.response.status_code if isinstance(e, httpx.HTTPStatusError) else None}\n"
|
|
440
|
+
f"Response content: {e.response.text if isinstance(e, httpx.HTTPStatusError) else None}\n"
|
|
441
|
+
)
|
|
442
|
+
did_fetched_current_state = False
|
|
442
443
|
|
|
443
444
|
creation_results: list[tuple[list[Entity], list[Exception]]] = []
|
|
444
445
|
|
|
@@ -457,36 +458,36 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
457
458
|
except asyncio.CancelledError as e:
|
|
458
459
|
logger.warning("Resync aborted successfully, skipping delete phase. This leads to an incomplete state")
|
|
459
460
|
raise
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
461
|
+
else:
|
|
462
|
+
if not did_fetched_current_state:
|
|
463
|
+
logger.warning(
|
|
464
|
+
"Due to an error before the resync, the previous state of entities at Port is unknown."
|
|
465
|
+
" Skipping delete phase due to unknown initial state."
|
|
466
|
+
)
|
|
467
|
+
return
|
|
468
|
+
|
|
469
|
+
logger.info("Starting resync diff calculation")
|
|
470
|
+
flat_created_entities, errors = zip_and_sum(creation_results) or [
|
|
471
|
+
[],
|
|
472
|
+
[],
|
|
473
|
+
]
|
|
474
|
+
|
|
475
|
+
if errors:
|
|
476
|
+
message = f"Resync failed with {len(errors)}. Skipping delete phase due to incomplete state"
|
|
477
|
+
error_group = ExceptionGroup(
|
|
478
|
+
f"Resync failed with {len(errors)}. Skipping delete phase due to incomplete state",
|
|
479
|
+
errors,
|
|
480
|
+
)
|
|
481
|
+
if not silent:
|
|
482
|
+
raise error_group
|
|
483
|
+
|
|
484
|
+
logger.error(message, exc_info=error_group)
|
|
485
|
+
else:
|
|
486
|
+
logger.info(
|
|
487
|
+
f"Running resync diff calculation, number of entities at Port before resync: {len(entities_at_port)}, number of entities created during sync: {len(flat_created_entities)}"
|
|
488
|
+
)
|
|
489
|
+
await self.entities_state_applier.delete_diff(
|
|
490
|
+
{"before": entities_at_port, "after": flat_created_entities},
|
|
491
|
+
user_agent_type,
|
|
492
|
+
)
|
|
493
|
+
logger.info("Resync finished successfully")
|
|
@@ -94,7 +94,7 @@ port_ocean/core/integrations/mixins/__init__.py,sha256=FA1FEKMM6P-L2_m7Q4L20mFa4
|
|
|
94
94
|
port_ocean/core/integrations/mixins/events.py,sha256=Ddfx2L4FpghV38waF8OfVeOV0bHBxNIgjU-q5ffillI,2341
|
|
95
95
|
port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
|
|
96
96
|
port_ocean/core/integrations/mixins/sync.py,sha256=B9fEs8faaYLLikH9GBjE_E61vo0bQDjIGQsQ1SRXOlA,3931
|
|
97
|
-
port_ocean/core/integrations/mixins/sync_raw.py,sha256=
|
|
97
|
+
port_ocean/core/integrations/mixins/sync_raw.py,sha256=hWaO1XbW7m2pUTGXlPJE30gOfbVhYhPXz0uNKEuDaNs,18849
|
|
98
98
|
port_ocean/core/integrations/mixins/utils.py,sha256=7y1rGETZIjOQadyIjFJXIHKkQFKx_SwiP-TrAIsyyLY,2303
|
|
99
99
|
port_ocean/core/models.py,sha256=dJ2_olTdbjUpObQJNmg7e7EENU_zZiX6XOaknNp54B0,1342
|
|
100
100
|
port_ocean/core/ocean_types.py,sha256=3_d8-n626f1kWLQ_Jxw194LEyrOVupz05qs_Y1pvB-A,990
|
|
@@ -140,8 +140,8 @@ port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,32
|
|
|
140
140
|
port_ocean/utils/signal.py,sha256=K-6kKFQTltcmKDhtyZAcn0IMa3sUpOHGOAUdWKgx0_E,1369
|
|
141
141
|
port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
|
|
142
142
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
|
143
|
-
port_ocean-0.12.2.
|
|
144
|
-
port_ocean-0.12.2.
|
|
145
|
-
port_ocean-0.12.2.
|
|
146
|
-
port_ocean-0.12.2.
|
|
147
|
-
port_ocean-0.12.2.
|
|
143
|
+
port_ocean-0.12.2.dev6.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
144
|
+
port_ocean-0.12.2.dev6.dist-info/METADATA,sha256=2jHYgbU6PsEbwOZIXbqyF9PfomB4mCoGmsBcdsr0XZU,6619
|
|
145
|
+
port_ocean-0.12.2.dev6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
146
|
+
port_ocean-0.12.2.dev6.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
147
|
+
port_ocean-0.12.2.dev6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|