port-ocean 0.10.7__py3-none-any.whl → 0.10.9__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 +1 -1
- port_ocean/clients/port/utils.py +1 -1
- port_ocean/config/settings.py +1 -1
- port_ocean/helpers/retry.py +5 -0
- port_ocean/middlewares.py +10 -2
- port_ocean/tests/clients/port/mixins/test_entities.py +53 -0
- port_ocean/utils/async_iterators.py +1 -1
- {port_ocean-0.10.7.dist-info → port_ocean-0.10.9.dist-info}/METADATA +1 -1
- {port_ocean-0.10.7.dist-info → port_ocean-0.10.9.dist-info}/RECORD +12 -11
- {port_ocean-0.10.7.dist-info → port_ocean-0.10.9.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.10.7.dist-info → port_ocean-0.10.9.dist-info}/WHEEL +0 -0
- {port_ocean-0.10.7.dist-info → port_ocean-0.10.9.dist-info}/entry_points.txt +0 -0
port_ocean/clients/port/utils.py
CHANGED
|
@@ -18,7 +18,7 @@ if TYPE_CHECKING:
|
|
|
18
18
|
# The max_keepalive_connections can't be too high, as it will cause the application to run out of available connections.
|
|
19
19
|
PORT_HTTP_MAX_CONNECTIONS_LIMIT = 200
|
|
20
20
|
PORT_HTTP_MAX_KEEP_ALIVE_CONNECTIONS = 50
|
|
21
|
-
PORT_HTTP_TIMEOUT =
|
|
21
|
+
PORT_HTTP_TIMEOUT = 60.0
|
|
22
22
|
|
|
23
23
|
PORT_HTTPX_TIMEOUT = httpx.Timeout(PORT_HTTP_TIMEOUT)
|
|
24
24
|
PORT_HTTPX_LIMITS = httpx.Limits(
|
port_ocean/config/settings.py
CHANGED
|
@@ -67,7 +67,7 @@ class IntegrationConfiguration(BaseOceanSettings, extra=Extra.allow):
|
|
|
67
67
|
allow_environment_variables_jq_access: bool = True
|
|
68
68
|
initialize_port_resources: bool = True
|
|
69
69
|
scheduled_resync_interval: int | None = None
|
|
70
|
-
client_timeout: int =
|
|
70
|
+
client_timeout: int = 60
|
|
71
71
|
send_raw_data_examples: bool = True
|
|
72
72
|
port: PortSettings
|
|
73
73
|
event_listener: EventListenerSettingsType = Field(
|
port_ocean/helpers/retry.py
CHANGED
|
@@ -290,6 +290,11 @@ class RetryTransport(httpx.AsyncBaseTransport, httpx.BaseTransport):
|
|
|
290
290
|
if remaining_attempts < 1:
|
|
291
291
|
self._log_error(request, error)
|
|
292
292
|
raise
|
|
293
|
+
except httpx.ReadTimeout as e:
|
|
294
|
+
error = e
|
|
295
|
+
if remaining_attempts < 1:
|
|
296
|
+
self._log_error(request, error)
|
|
297
|
+
raise
|
|
293
298
|
except httpx.TimeoutException as e:
|
|
294
299
|
error = e
|
|
295
300
|
if remaining_attempts < 1:
|
port_ocean/middlewares.py
CHANGED
|
@@ -52,7 +52,14 @@ async def request_handler(
|
|
|
52
52
|
request_id = generate_uuid()
|
|
53
53
|
|
|
54
54
|
with logger.contextualize(request_id=request_id):
|
|
55
|
-
|
|
55
|
+
log_level = (
|
|
56
|
+
"DEBUG"
|
|
57
|
+
if request.url.path == "/docs" or request.url.path == "/openapi.json"
|
|
58
|
+
else "INFO"
|
|
59
|
+
)
|
|
60
|
+
logger.bind(url=str(request.url), method=request.method).log(
|
|
61
|
+
log_level, f"Request to {request.url.path} started"
|
|
62
|
+
)
|
|
56
63
|
response = await _handle_silently(call_next, request)
|
|
57
64
|
|
|
58
65
|
end_time = get_time(seconds_precision=False)
|
|
@@ -61,5 +68,6 @@ async def request_handler(
|
|
|
61
68
|
response.headers["X-Process-Time"] = str(time_elapsed)
|
|
62
69
|
logger.bind(
|
|
63
70
|
time_elapsed=time_elapsed, response_status=response.status_code
|
|
64
|
-
).
|
|
71
|
+
).log(log_level, f"Request to {request.url.path} ended")
|
|
72
|
+
|
|
65
73
|
return response
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from unittest.mock import MagicMock
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from port_ocean.clients.port.mixins.entities import EntityClientMixin
|
|
7
|
+
from port_ocean.core.models import Entity
|
|
8
|
+
from httpx import ReadTimeout
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
errored_entity_identifier: str = "a"
|
|
12
|
+
expected_result_entities = [
|
|
13
|
+
Entity(identifier="b", blueprint="b"),
|
|
14
|
+
Entity(identifier="c", blueprint="c"),
|
|
15
|
+
]
|
|
16
|
+
all_entities = [
|
|
17
|
+
Entity(identifier=errored_entity_identifier, blueprint="a")
|
|
18
|
+
] + expected_result_entities
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async def mock_upsert_entity(entity: Entity, *args: Any, **kwargs: Any) -> Entity:
|
|
22
|
+
if entity.identifier == errored_entity_identifier:
|
|
23
|
+
raise ReadTimeout("")
|
|
24
|
+
else:
|
|
25
|
+
return entity
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.fixture
|
|
29
|
+
async def entity_client(monkeypatch: Any) -> EntityClientMixin:
|
|
30
|
+
# Arrange
|
|
31
|
+
entity_client = EntityClientMixin(auth=MagicMock(), client=MagicMock())
|
|
32
|
+
monkeypatch.setattr(entity_client, "upsert_entity", mock_upsert_entity)
|
|
33
|
+
|
|
34
|
+
return entity_client
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async def test_batch_upsert_entities_read_timeout_should_raise_false(
|
|
38
|
+
entity_client: EntityClientMixin,
|
|
39
|
+
) -> None:
|
|
40
|
+
result_entities = await entity_client.batch_upsert_entities(
|
|
41
|
+
entities=all_entities, request_options=MagicMock(), should_raise=False
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
assert result_entities == expected_result_entities
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
async def test_batch_upsert_entities_read_timeout_should_raise_true(
|
|
48
|
+
entity_client: EntityClientMixin,
|
|
49
|
+
) -> None:
|
|
50
|
+
with pytest.raises(ReadTimeout):
|
|
51
|
+
await entity_client.batch_upsert_entities(
|
|
52
|
+
entities=all_entities, request_options=MagicMock(), should_raise=True
|
|
53
|
+
)
|
|
@@ -44,16 +44,16 @@ port_ocean/clients/port/authentication.py,sha256=t3z6h4vld-Tzkpth15sstaMJg0rccX-
|
|
|
44
44
|
port_ocean/clients/port/client.py,sha256=Xd8Jk25Uh4WXY_WW-z1Qbv6F3ZTBFPoOolsxHMfozKw,3366
|
|
45
45
|
port_ocean/clients/port/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
port_ocean/clients/port/mixins/blueprints.py,sha256=8ZVC5i8K1WKQMJJiPqZmgcOlF3OyxWz1aAQ_WA5UW3c,4500
|
|
47
|
-
port_ocean/clients/port/mixins/entities.py,sha256=
|
|
47
|
+
port_ocean/clients/port/mixins/entities.py,sha256=WdqT1gyS81pByUl9xIfZz_xEHRaBfDuZ-ekKX53oBSE,8870
|
|
48
48
|
port_ocean/clients/port/mixins/integrations.py,sha256=HnWXaJt41SUcha-bhvLdJW07j-l7xIo91GUzzwl2f_E,4859
|
|
49
49
|
port_ocean/clients/port/mixins/migrations.py,sha256=A6896oJF6WbFL2WroyTkMzr12yhVyWqGoq9dtLNSKBY,1457
|
|
50
50
|
port_ocean/clients/port/retry_transport.py,sha256=PtIZOAZ6V-ncpVysRUsPOgt8Sf01QLnTKB5YeKBxkJk,1861
|
|
51
51
|
port_ocean/clients/port/types.py,sha256=nvlgiAq4WH5_F7wQbz_GAWl-faob84LVgIjZ2Ww5mTk,451
|
|
52
|
-
port_ocean/clients/port/utils.py,sha256=
|
|
52
|
+
port_ocean/clients/port/utils.py,sha256=5B6rHgiVrtiL4YWh7Eq7_ncIeDwrDsB7jIvRik5xH8c,2373
|
|
53
53
|
port_ocean/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
port_ocean/config/base.py,sha256=x1gFbzujrxn7EJudRT81C6eN9WsYAb3vOHwcpcpX8Tc,6370
|
|
55
55
|
port_ocean/config/dynamic.py,sha256=qOFkRoJsn_BW7581omi_AoMxoHqasf_foxDQ_G11_SI,2030
|
|
56
|
-
port_ocean/config/settings.py,sha256=
|
|
56
|
+
port_ocean/config/settings.py,sha256=77MtPz-ZpOWjuuOcorAy4MSNuYhRE2a9DDBKx3sRrV8,4274
|
|
57
57
|
port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
58
|
port_ocean/consumers/kafka_consumer.py,sha256=N8KocjBi9aR0BOPG8hgKovg-ns_ggpEjrSxqSqF_BSo,4710
|
|
59
59
|
port_ocean/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -110,22 +110,23 @@ port_ocean/exceptions/port_defaults.py,sha256=pJ5im06ziDX2IVstSlYIjVHhs4JW-N0Vr0
|
|
|
110
110
|
port_ocean/exceptions/utils.py,sha256=gjOqpi-HpY1l4WlMFsGA9yzhxDhajhoGGdDDyGbLnqI,197
|
|
111
111
|
port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
112
112
|
port_ocean/helpers/async_client.py,sha256=SRlP6o7_FCSY3UHnRlZdezppePVxxOzZ0z861vE3K40,1783
|
|
113
|
-
port_ocean/helpers/retry.py,sha256=
|
|
113
|
+
port_ocean/helpers/retry.py,sha256=IQ0RfQ2T5o6uoZh2WW2nrFH5TT6K_k3y2Im0HDp5j9Y,15059
|
|
114
114
|
port_ocean/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
115
115
|
port_ocean/log/handlers.py,sha256=k9G_Mb4ga2-Jke9irpdlYqj6EYiwv0gEsh4TgyqqOmI,2853
|
|
116
116
|
port_ocean/log/logger_setup.py,sha256=BaXt-mh9CVXhneh37H46d04lqOdIBixG1pFyGfotuZs,2328
|
|
117
117
|
port_ocean/log/sensetive.py,sha256=wkyvkKMbyLTjZDSbvvLHL9bv4RvD0DPAyL3uWSttUOA,2916
|
|
118
|
-
port_ocean/middlewares.py,sha256=
|
|
118
|
+
port_ocean/middlewares.py,sha256=9wYCdyzRZGK1vjEJ28FY_DkfwDNENmXp504UKPf5NaQ,2727
|
|
119
119
|
port_ocean/ocean.py,sha256=0dtaiRxKgY3kYNm1ZI3uFCJRhnNoTMwVv-PkWlLJQrQ,4842
|
|
120
120
|
port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
121
121
|
port_ocean/run.py,sha256=rTxBlrQd4yyrtgErCFJCHCEHs7d1OXrRiJehUYmIbN0,2212
|
|
122
122
|
port_ocean/sonar-project.properties,sha256=X_wLzDOkEVmpGLRMb2fg9Rb0DxWwUFSvESId8qpvrPI,73
|
|
123
123
|
port_ocean/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
124
|
+
port_ocean/tests/clients/port/mixins/test_entities.py,sha256=A9myrnkLhKSQrnOLv1Zz2wiOVSxW65Q9RIUIRbn_V7w,1586
|
|
124
125
|
port_ocean/tests/helpers/__init__.py,sha256=XQBdAi54t9VavF11dGVLeS1jSoEKRjqRemKskLh-nSo,2377
|
|
125
126
|
port_ocean/tests/test_sample.py,sha256=Ew5LA_G1k6DC5a2ygU2FoyjZQa0fRmPy73N0bio0d14,46
|
|
126
127
|
port_ocean/utils/__init__.py,sha256=KMGnCPXZJbNwtgxtyMycapkDz8tpSyw23MSYT3iVeHs,91
|
|
127
128
|
port_ocean/utils/async_http.py,sha256=arnH458TExn2Dju_Sy6pHas_vF5RMWnOp-jBz5WAAcE,1226
|
|
128
|
-
port_ocean/utils/async_iterators.py,sha256=
|
|
129
|
+
port_ocean/utils/async_iterators.py,sha256=iw3cUHxfQm3zUSPdw2FmSXDU8E1Ppnys4TGhswNuQ8s,1569
|
|
129
130
|
port_ocean/utils/cache.py,sha256=3KItZDE2yVrbVDr-hoM8lNna8s2dlpxhP4ICdLjH4LQ,2231
|
|
130
131
|
port_ocean/utils/misc.py,sha256=0q2cJ5psqxn_5u_56pT7vOVQ3shDM02iC1lzyWQ_zl0,2098
|
|
131
132
|
port_ocean/utils/queue_utils.py,sha256=KWWl8YVnG-glcfIHhM6nefY-2sou_C6DVP1VynQwzB4,2762
|
|
@@ -133,8 +134,8 @@ port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,32
|
|
|
133
134
|
port_ocean/utils/signal.py,sha256=K-6kKFQTltcmKDhtyZAcn0IMa3sUpOHGOAUdWKgx0_E,1369
|
|
134
135
|
port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
|
|
135
136
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
|
136
|
-
port_ocean-0.10.
|
|
137
|
-
port_ocean-0.10.
|
|
138
|
-
port_ocean-0.10.
|
|
139
|
-
port_ocean-0.10.
|
|
140
|
-
port_ocean-0.10.
|
|
137
|
+
port_ocean-0.10.9.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
138
|
+
port_ocean-0.10.9.dist-info/METADATA,sha256=Tn_OhvGN0aY5xiMXhcITu61Kwsv8CpEtc-lhsMtAYU0,6616
|
|
139
|
+
port_ocean-0.10.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
140
|
+
port_ocean-0.10.9.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
141
|
+
port_ocean-0.10.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|