port-ocean 0.27.1__py3-none-any.whl → 0.27.2__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.
- port_ocean/config/settings.py +2 -0
- port_ocean/core/handlers/entity_processor/jq_entity_processor.py +10 -9
- port_ocean/core/integrations/mixins/sync_raw.py +1 -1
- port_ocean/core/integrations/mixins/utils.py +26 -3
- {port_ocean-0.27.1.dist-info → port_ocean-0.27.2.dist-info}/METADATA +1 -1
- {port_ocean-0.27.1.dist-info → port_ocean-0.27.2.dist-info}/RECORD +9 -9
- {port_ocean-0.27.1.dist-info → port_ocean-0.27.2.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.27.1.dist-info → port_ocean-0.27.2.dist-info}/WHEEL +0 -0
- {port_ocean-0.27.1.dist-info → port_ocean-0.27.2.dist-info}/entry_points.txt +0 -0
port_ocean/config/settings.py
CHANGED
@@ -111,6 +111,8 @@ class IntegrationConfiguration(BaseOceanSettings, extra=Extra.allow):
|
|
111
111
|
upsert_entities_batch_max_length: int = 20
|
112
112
|
upsert_entities_batch_max_size_in_bytes: int = 1024 * 1024
|
113
113
|
lakehouse_enabled: bool = False
|
114
|
+
yield_items_to_parse: bool = False
|
115
|
+
yield_items_to_parse_batch_size: int = 10
|
114
116
|
|
115
117
|
@validator("process_execution_mode")
|
116
118
|
def validate_process_execution_mode(
|
@@ -246,15 +246,16 @@ class JQEntityProcessor(BaseEntityProcessor):
|
|
246
246
|
parse_all: bool = False,
|
247
247
|
) -> tuple[list[MappedEntity], list[Exception]]:
|
248
248
|
raw_data = [data.copy()]
|
249
|
-
if
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
249
|
+
if not ocean.config.yield_items_to_parse:
|
250
|
+
if items_to_parse:
|
251
|
+
items = await self._search(data, items_to_parse)
|
252
|
+
if not isinstance(items, list):
|
253
|
+
logger.warning(
|
254
|
+
f"Failed to parse items for JQ expression {items_to_parse}, Expected list but got {type(items)}."
|
255
|
+
f" Skipping..."
|
256
|
+
)
|
257
|
+
return [], []
|
258
|
+
raw_data = [{"item": item, **data} for item in items]
|
258
259
|
|
259
260
|
entities, errors = await gather_and_split_errors_from_results(
|
260
261
|
[
|
@@ -116,7 +116,7 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
116
116
|
logger.info(
|
117
117
|
f"Found async generator function for {resource_config.kind} name: {task.__qualname__}"
|
118
118
|
)
|
119
|
-
results.append(resync_generator_wrapper(task, resource_config.kind))
|
119
|
+
results.append(resync_generator_wrapper(task, resource_config.kind,resource_config.port.items_to_parse))
|
120
120
|
else:
|
121
121
|
logger.info(
|
122
122
|
f"Found sync function for {resource_config.kind} name: {task.__qualname__}"
|
@@ -1,11 +1,13 @@
|
|
1
1
|
from contextlib import contextmanager
|
2
|
-
from typing import Awaitable, Generator, Callable
|
2
|
+
from typing import Awaitable, Generator, Callable, cast
|
3
3
|
|
4
4
|
from loguru import logger
|
5
5
|
|
6
6
|
import asyncio
|
7
7
|
import multiprocessing
|
8
8
|
|
9
|
+
from port_ocean.core.handlers.entity_processor.jq_entity_processor import JQEntityProcessor
|
10
|
+
from port_ocean.core.handlers.port_app_config.models import ResourceConfig
|
9
11
|
from port_ocean.core.ocean_types import (
|
10
12
|
ASYNC_GENERATOR_RESYNC_TYPE,
|
11
13
|
RAW_RESULT,
|
@@ -49,7 +51,7 @@ async def resync_function_wrapper(
|
|
49
51
|
|
50
52
|
|
51
53
|
async def resync_generator_wrapper(
|
52
|
-
fn: Callable[[str], ASYNC_GENERATOR_RESYNC_TYPE], kind: str
|
54
|
+
fn: Callable[[str], ASYNC_GENERATOR_RESYNC_TYPE], kind: str, items_to_parse: str | None = None
|
53
55
|
) -> ASYNC_GENERATOR_RESYNC_TYPE:
|
54
56
|
generator = fn(kind)
|
55
57
|
errors = []
|
@@ -58,7 +60,28 @@ async def resync_generator_wrapper(
|
|
58
60
|
try:
|
59
61
|
with resync_error_handling():
|
60
62
|
result = await anext(generator)
|
61
|
-
|
63
|
+
if not ocean.config.yield_items_to_parse:
|
64
|
+
yield validate_result(result)
|
65
|
+
else:
|
66
|
+
batch_size = ocean.config.yield_items_to_parse_batch_size
|
67
|
+
if items_to_parse:
|
68
|
+
for data in result:
|
69
|
+
items = await cast(JQEntityProcessor, ocean.app.integration.entity_processor)._search(data, items_to_parse)
|
70
|
+
if not isinstance(items, list):
|
71
|
+
logger.warning(
|
72
|
+
f"Failed to parse items for JQ expression {items_to_parse}, Expected list but got {type(items)}."
|
73
|
+
f" Skipping..."
|
74
|
+
)
|
75
|
+
yield []
|
76
|
+
raw_data = [{"item": item, **data} for item in items]
|
77
|
+
while True:
|
78
|
+
raw_data_batch = raw_data[:batch_size]
|
79
|
+
yield raw_data_batch
|
80
|
+
raw_data = raw_data[batch_size:]
|
81
|
+
if len(raw_data) == 0:
|
82
|
+
break
|
83
|
+
else:
|
84
|
+
yield validate_result(result)
|
62
85
|
except OceanAbortException as error:
|
63
86
|
errors.append(error)
|
64
87
|
ocean.metrics.inc_metric(
|
@@ -70,7 +70,7 @@ port_ocean/clients/port/utils.py,sha256=osFyAjw7Y5Qf2uVSqC7_RTCQfijiL1zS74JJM0go
|
|
70
70
|
port_ocean/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
71
71
|
port_ocean/config/base.py,sha256=x1gFbzujrxn7EJudRT81C6eN9WsYAb3vOHwcpcpX8Tc,6370
|
72
72
|
port_ocean/config/dynamic.py,sha256=Lrk4JRGtR-0YKQ9DDGexX5NGFE7EJ6VoHya19YYhssM,2687
|
73
|
-
port_ocean/config/settings.py,sha256
|
73
|
+
port_ocean/config/settings.py,sha256=-jgVUBiFbeVjd9GjkMH6cRLLQHhtvI9x1WNdVE5s_p0,7311
|
74
74
|
port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
75
75
|
port_ocean/consumers/kafka_consumer.py,sha256=N8KocjBi9aR0BOPG8hgKovg-ns_ggpEjrSxqSqF_BSo,4710
|
76
76
|
port_ocean/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -101,7 +101,7 @@ port_ocean/core/handlers/entities_state_applier/port/get_related_entities.py,sha
|
|
101
101
|
port_ocean/core/handlers/entities_state_applier/port/order_by_entities_dependencies.py,sha256=lyv6xKzhYfd6TioUgR3AVRSJqj7JpAaj1LxxU2xAqeo,1720
|
102
102
|
port_ocean/core/handlers/entity_processor/__init__.py,sha256=FvFCunFg44wNQoqlybem9MthOs7p1Wawac87uSXz9U8,156
|
103
103
|
port_ocean/core/handlers/entity_processor/base.py,sha256=PsnpNRqjHth9xwOvDRe7gKu8cjnVV0XGmTIHGvOelX0,1867
|
104
|
-
port_ocean/core/handlers/entity_processor/jq_entity_processor.py,sha256=
|
104
|
+
port_ocean/core/handlers/entity_processor/jq_entity_processor.py,sha256=t_Z6etgxG6IQLNRLxG06SEj5IyAVRujuf0ox0DXd4A8,12873
|
105
105
|
port_ocean/core/handlers/port_app_config/__init__.py,sha256=8AAT5OthiVM7KCcM34iEgEeXtn2pRMrT4Dze5r1Ixbk,134
|
106
106
|
port_ocean/core/handlers/port_app_config/api.py,sha256=r_Th66NEw38IpRdnXZcRvI8ACfvxW_A6V62WLwjWXlQ,1044
|
107
107
|
port_ocean/core/handlers/port_app_config/base.py,sha256=Sup4-X_a7JGa27rMy_OgqGIjFHMlKBpKevicaK3AeHU,2919
|
@@ -123,8 +123,8 @@ port_ocean/core/integrations/mixins/events.py,sha256=2L7P3Jhp8XBqddh2_o9Cn4N261n
|
|
123
123
|
port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
|
124
124
|
port_ocean/core/integrations/mixins/live_events.py,sha256=zM24dhNc7uHx9XYZ6toVhDADPA90EnpOmZxgDegFZbA,4196
|
125
125
|
port_ocean/core/integrations/mixins/sync.py,sha256=Vm_898pLKBwfVewtwouDWsXoxcOLicnAy6pzyqqk6U8,4053
|
126
|
-
port_ocean/core/integrations/mixins/sync_raw.py,sha256=
|
127
|
-
port_ocean/core/integrations/mixins/utils.py,sha256=
|
126
|
+
port_ocean/core/integrations/mixins/sync_raw.py,sha256=OptSievJ1c9vw-0PKmYuT2GgbCH6HC04yEyi0MUQF9k,39351
|
127
|
+
port_ocean/core/integrations/mixins/utils.py,sha256=r7VKatZDip5D0hu-chCK3IeuM1gItleOEJboNN0Zvdk,5309
|
128
128
|
port_ocean/core/models.py,sha256=DNbKpStMINI2lIekKprTqBevqkw_wFuFayN19w1aDfQ,2893
|
129
129
|
port_ocean/core/ocean_types.py,sha256=bkLlTd8XfJK6_JDl0eXUHfE_NygqgiInSMwJ4YJH01Q,1399
|
130
130
|
port_ocean/core/utils/entity_topological_sorter.py,sha256=MDUjM6OuDy4Xj68o-7InNN0w1jqjxeDfeY8U02vySNI,3081
|
@@ -205,8 +205,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
|
|
205
205
|
port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
|
206
206
|
port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
|
207
207
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
208
|
-
port_ocean-0.27.
|
209
|
-
port_ocean-0.27.
|
210
|
-
port_ocean-0.27.
|
211
|
-
port_ocean-0.27.
|
212
|
-
port_ocean-0.27.
|
208
|
+
port_ocean-0.27.2.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
209
|
+
port_ocean-0.27.2.dist-info/METADATA,sha256=i1U80P8ZYN4o6kNPfWsYpcCnPlQsBSoh0llLjg4Dk7A,6887
|
210
|
+
port_ocean-0.27.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
211
|
+
port_ocean-0.27.2.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
212
|
+
port_ocean-0.27.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|