port-ocean 0.9.2__py3-none-any.whl → 0.9.2.dev1__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/core/handlers/entity_processor/jq_entity_processor.py +39 -16
- port_ocean/core/integrations/mixins/sync_raw.py +2 -1
- {port_ocean-0.9.2.dist-info → port_ocean-0.9.2.dev1.dist-info}/METADATA +3 -3
- {port_ocean-0.9.2.dist-info → port_ocean-0.9.2.dev1.dist-info}/RECORD +7 -7
- {port_ocean-0.9.2.dist-info → port_ocean-0.9.2.dev1.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.9.2.dist-info → port_ocean-0.9.2.dev1.dist-info}/WHEEL +0 -0
- {port_ocean-0.9.2.dist-info → port_ocean-0.9.2.dev1.dist-info}/entry_points.txt +0 -0
|
@@ -4,6 +4,7 @@ from asyncio import Task
|
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
from functools import lru_cache
|
|
6
6
|
from typing import Any, Optional
|
|
7
|
+
from uuid import uuid4
|
|
7
8
|
|
|
8
9
|
import pyjq as jq # type: ignore
|
|
9
10
|
from loguru import logger
|
|
@@ -47,22 +48,53 @@ class JQEntityProcessor(BaseEntityProcessor):
|
|
|
47
48
|
return jq.compile(pattern)
|
|
48
49
|
|
|
49
50
|
async def _search(self, data: dict[str, Any], pattern: str) -> Any:
|
|
51
|
+
identifier = str(uuid4())
|
|
50
52
|
try:
|
|
51
53
|
loop = asyncio.get_event_loop()
|
|
54
|
+
logger.info(
|
|
55
|
+
f"__COMPILING__ jq execution with pattern: {pattern}. trace-id: {identifier}"
|
|
56
|
+
)
|
|
52
57
|
compiled_pattern = self._compile(pattern)
|
|
53
58
|
first_value_callable = functools.partial(compiled_pattern.first, data)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
logger.info(
|
|
60
|
+
f"__STARTING__ jq execution with pattern: {pattern} and data: {data}. trace-id: {identifier}"
|
|
61
|
+
)
|
|
62
|
+
result = await loop.run_in_executor(None, first_value_callable)
|
|
63
|
+
logger.info(
|
|
64
|
+
f"__FINISHED__ jq execution with pattern: {pattern} and data: {data}. trace-id: {identifier} \n"
|
|
65
|
+
f"Result {result}"
|
|
66
|
+
)
|
|
67
|
+
return result
|
|
68
|
+
except Exception as e:
|
|
69
|
+
logger.error(
|
|
70
|
+
f"__FAILED__ jq execution with pattern: {pattern} and data: {data}. trace-id: {identifier} \n"
|
|
71
|
+
f"Error {e}"
|
|
58
72
|
)
|
|
59
73
|
return None
|
|
60
74
|
|
|
61
75
|
async def _search_as_bool(self, data: dict[str, Any], pattern: str) -> bool:
|
|
62
76
|
loop = asyncio.get_event_loop()
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
identifier = str(uuid4())
|
|
78
|
+
try:
|
|
79
|
+
logger.info(
|
|
80
|
+
f"__COMPILING_BOOL__ jq execution with pattern: {pattern}. trace-id: {identifier}"
|
|
81
|
+
)
|
|
82
|
+
compiled_pattern = self._compile(pattern)
|
|
83
|
+
first_value_callable = functools.partial(compiled_pattern.first, data)
|
|
84
|
+
logger.info(
|
|
85
|
+
f"__STARTING_BOOL__ jq execution with pattern: {pattern} and data: {data}. trace-id: {identifier}"
|
|
86
|
+
)
|
|
87
|
+
value = await loop.run_in_executor(None, first_value_callable)
|
|
88
|
+
logger.info(
|
|
89
|
+
f"__FINISHED_BOOL__ jq execution with pattern: {pattern} and data: {data}. trace-id: {identifier} \n"
|
|
90
|
+
f"Result {value}"
|
|
91
|
+
)
|
|
92
|
+
except Exception as e:
|
|
93
|
+
logger.error(
|
|
94
|
+
f"__FAILED_BOOL__ jq execution with pattern: {pattern} and data: {data}. trace-id: {identifier} \n"
|
|
95
|
+
f"Error {e}"
|
|
96
|
+
)
|
|
97
|
+
raise
|
|
66
98
|
|
|
67
99
|
if isinstance(value, bool):
|
|
68
100
|
return value
|
|
@@ -210,15 +242,6 @@ class JQEntityProcessor(BaseEntityProcessor):
|
|
|
210
242
|
examples_to_send.append(result.raw_data)
|
|
211
243
|
else:
|
|
212
244
|
failed_entities.append(parsed_entity)
|
|
213
|
-
if (
|
|
214
|
-
not calculated_entities_results
|
|
215
|
-
and raw_results
|
|
216
|
-
and send_raw_data_examples_amount > 0
|
|
217
|
-
):
|
|
218
|
-
logger.warning(
|
|
219
|
-
f"No entities were parsed from {len(raw_results)} raw results, sending raw data examples"
|
|
220
|
-
)
|
|
221
|
-
examples_to_send = raw_results[:send_raw_data_examples_amount]
|
|
222
245
|
|
|
223
246
|
await self._send_examples(examples_to_send, mapping.kind)
|
|
224
247
|
|
|
@@ -90,6 +90,7 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
90
90
|
) -> tuple[RESYNC_RESULT, list[RAW_RESULT | Exception]]:
|
|
91
91
|
tasks = []
|
|
92
92
|
results = []
|
|
93
|
+
|
|
93
94
|
for task in fns:
|
|
94
95
|
if inspect.isasyncgenfunction(task):
|
|
95
96
|
results.append(resync_generator_wrapper(task, resource_config.kind))
|
|
@@ -414,7 +415,7 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
414
415
|
app_config = await self.port_app_config_handler.get_port_app_config(
|
|
415
416
|
use_cache=False
|
|
416
417
|
)
|
|
417
|
-
|
|
418
|
+
|
|
418
419
|
try:
|
|
419
420
|
entities_at_port = await ocean.port_client.search_entities(
|
|
420
421
|
user_agent_type
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: port-ocean
|
|
3
|
-
Version: 0.9.2
|
|
3
|
+
Version: 0.9.2.dev1
|
|
4
4
|
Summary: Port Ocean is a CLI tool for managing your Port projects.
|
|
5
5
|
Home-page: https://app.getport.io
|
|
6
6
|
Keywords: ocean,port-ocean,port
|
|
@@ -25,7 +25,7 @@ Requires-Dist: aiostream (>=0.5.2,<0.7.0)
|
|
|
25
25
|
Requires-Dist: click (>=8.1.3,<9.0.0) ; extra == "cli"
|
|
26
26
|
Requires-Dist: confluent-kafka (>=2.1.1,<3.0.0)
|
|
27
27
|
Requires-Dist: cookiecutter (>=2.1.1,<3.0.0) ; extra == "cli"
|
|
28
|
-
Requires-Dist: fastapi (>=0.100,<0.
|
|
28
|
+
Requires-Dist: fastapi (>=0.100,<0.111)
|
|
29
29
|
Requires-Dist: httpx (>=0.24.1,<0.28.0)
|
|
30
30
|
Requires-Dist: jinja2-time (>=0.2.0,<0.3.0) ; extra == "cli"
|
|
31
31
|
Requires-Dist: loguru (>=0.7.0,<0.8.0)
|
|
@@ -38,7 +38,7 @@ Requires-Dist: rich (>=13.4.1,<14.0.0) ; extra == "cli"
|
|
|
38
38
|
Requires-Dist: six (>=1.16.0,<2.0.0)
|
|
39
39
|
Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
40
40
|
Requires-Dist: urllib3 (>=1.26.16,<3.0.0)
|
|
41
|
-
Requires-Dist: uvicorn (>=0.22,<0.
|
|
41
|
+
Requires-Dist: uvicorn (>=0.22,<0.30)
|
|
42
42
|
Requires-Dist: werkzeug (>=2.3.4,<4.0.0)
|
|
43
43
|
Project-URL: Repository, https://github.com/port-labs/Port-Ocean
|
|
44
44
|
Description-Content-Type: text/markdown
|
|
@@ -77,7 +77,7 @@ port_ocean/core/handlers/entities_state_applier/port/get_related_entities.py,sha
|
|
|
77
77
|
port_ocean/core/handlers/entities_state_applier/port/order_by_entities_dependencies.py,sha256=82BvU8t5w9uhsxX8hbnwuRPuWhW3cMeuT_5sVIkip1I,1550
|
|
78
78
|
port_ocean/core/handlers/entity_processor/__init__.py,sha256=FvFCunFg44wNQoqlybem9MthOs7p1Wawac87uSXz9U8,156
|
|
79
79
|
port_ocean/core/handlers/entity_processor/base.py,sha256=udR0w5TstTOS5xOfTjAZIEdldn4xr6Oyb3DylatYX3Q,1869
|
|
80
|
-
port_ocean/core/handlers/entity_processor/jq_entity_processor.py,sha256=
|
|
80
|
+
port_ocean/core/handlers/entity_processor/jq_entity_processor.py,sha256=Ra6Gtv0VKa0VTj2ymcn1XDE1_8DNx6Soo2-oZi7Qo5g,9312
|
|
81
81
|
port_ocean/core/handlers/port_app_config/__init__.py,sha256=8AAT5OthiVM7KCcM34iEgEeXtn2pRMrT4Dze5r1Ixbk,134
|
|
82
82
|
port_ocean/core/handlers/port_app_config/api.py,sha256=6VbKPwFzsWG0IYsVD81hxSmfqtHUFqrfUuj1DBX5g4w,853
|
|
83
83
|
port_ocean/core/handlers/port_app_config/base.py,sha256=oufdNLzUmEgJY5PgIz75zDlowWrjA-y8WR4UnM58E58,2897
|
|
@@ -88,7 +88,7 @@ port_ocean/core/integrations/mixins/__init__.py,sha256=FA1FEKMM6P-L2_m7Q4L20mFa4
|
|
|
88
88
|
port_ocean/core/integrations/mixins/events.py,sha256=Ddfx2L4FpghV38waF8OfVeOV0bHBxNIgjU-q5ffillI,2341
|
|
89
89
|
port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
|
|
90
90
|
port_ocean/core/integrations/mixins/sync.py,sha256=TKqRytxXONVhuCo3CB3rDvWNbITnZz33TYTDs3SWWVk,3880
|
|
91
|
-
port_ocean/core/integrations/mixins/sync_raw.py,sha256=
|
|
91
|
+
port_ocean/core/integrations/mixins/sync_raw.py,sha256=yFORznT6TXX7SXP1sSoHAjLxmjDzXIr3Vu-plbhLBoA,18017
|
|
92
92
|
port_ocean/core/integrations/mixins/utils.py,sha256=7y1rGETZIjOQadyIjFJXIHKkQFKx_SwiP-TrAIsyyLY,2303
|
|
93
93
|
port_ocean/core/models.py,sha256=4bDvMeydlSpG0YSXjE1Bo2AcZC0aQ2zqFhpsOvZat_A,1190
|
|
94
94
|
port_ocean/core/ocean_types.py,sha256=3_d8-n626f1kWLQ_Jxw194LEyrOVupz05qs_Y1pvB-A,990
|
|
@@ -122,8 +122,8 @@ port_ocean/utils/queue_utils.py,sha256=KWWl8YVnG-glcfIHhM6nefY-2sou_C6DVP1VynQwz
|
|
|
122
122
|
port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,3231
|
|
123
123
|
port_ocean/utils/signal.py,sha256=K-6kKFQTltcmKDhtyZAcn0IMa3sUpOHGOAUdWKgx0_E,1369
|
|
124
124
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
|
125
|
-
port_ocean-0.9.2.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
126
|
-
port_ocean-0.9.2.dist-info/METADATA,sha256=
|
|
127
|
-
port_ocean-0.9.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
128
|
-
port_ocean-0.9.2.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
129
|
-
port_ocean-0.9.2.dist-info/RECORD,,
|
|
125
|
+
port_ocean-0.9.2.dev1.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
126
|
+
port_ocean-0.9.2.dev1.dist-info/METADATA,sha256=ObC0NM-3CS4aTOulc8e_by_8C59mU0hG6NX18Sa0CTY,6566
|
|
127
|
+
port_ocean-0.9.2.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
128
|
+
port_ocean-0.9.2.dev1.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
129
|
+
port_ocean-0.9.2.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|