port-ocean 0.12.2.dev1__py3-none-any.whl → 0.12.2.dev3__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.

@@ -1,6 +1,6 @@
1
1
  import asyncio
2
2
  from abc import abstractmethod
3
- from concurrent.futures import ThreadPoolExecutor
3
+ from concurrent.futures import ProcessPoolExecutor
4
4
  from typing import TypedDict, Callable, Any, Awaitable
5
5
 
6
6
  from pydantic import Extra
@@ -70,7 +70,7 @@ class BaseEventListener:
70
70
  await self._before_resync()
71
71
  try:
72
72
  loop = asyncio.get_event_loop()
73
- with ThreadPoolExecutor() as executor:
73
+ with ProcessPoolExecutor() as executor:
74
74
  e = executor.submit(
75
75
  lambda: asyncio.run_coroutine_threadsafe(
76
76
  self.events["on_resync"](resync_args), loop
@@ -173,48 +173,49 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
173
173
  self, resource_config: ResourceConfig, user_agent_type: UserAgentType
174
174
  ) -> tuple[list[Entity], list[Exception]]:
175
175
  results, errors = await self._get_resource_raw_results(resource_config)
176
- async_generators: list[ASYNC_GENERATOR_RESYNC_TYPE] = []
177
- raw_results: RAW_RESULT = []
178
- for result in results:
179
- if isinstance(result, dict):
180
- raw_results.append(result)
181
- else:
182
- async_generators.append(result)
183
-
184
- send_raw_data_examples_amount = (
185
- SEND_RAW_DATA_EXAMPLES_AMOUNT if ocean.config.send_raw_data_examples else 0
186
- )
187
- all_entities, register_errors = await self._register_resource_raw(
188
- resource_config,
189
- raw_results,
190
- user_agent_type,
191
- send_raw_data_examples_amount=send_raw_data_examples_amount,
192
- )
193
- errors.extend(register_errors)
194
- passed_entities = list(all_entities.passed)
195
-
196
- for generator in async_generators:
197
- try:
198
- async for items in generator:
199
- if send_raw_data_examples_amount > 0:
200
- send_raw_data_examples_amount = max(
201
- 0, send_raw_data_examples_amount - len(passed_entities)
202
- )
203
-
204
- entities, register_errors = await self._register_resource_raw(
205
- resource_config,
206
- items,
207
- user_agent_type,
208
- send_raw_data_examples_amount=send_raw_data_examples_amount,
209
- )
210
- errors.extend(register_errors)
211
- passed_entities.extend(entities.passed)
212
- except* OceanAbortException as error:
213
- errors.append(error)
214
-
215
- logger.info(
216
- f"Finished registering change for {len(results)} raw results for kind: {resource_config.kind}. {len(passed_entities)} entities were affected"
217
- )
176
+ passed_entities = []
177
+ # async_generators: list[ASYNC_GENERATOR_RESYNC_TYPE] = []
178
+ # raw_results: RAW_RESULT = []
179
+ # for result in results:
180
+ # if isinstance(result, dict):
181
+ # raw_results.append(result)
182
+ # else:
183
+ # async_generators.append(result)
184
+ #
185
+ # send_raw_data_examples_amount = (
186
+ # SEND_RAW_DATA_EXAMPLES_AMOUNT if ocean.config.send_raw_data_examples else 0
187
+ # )
188
+ # all_entities, register_errors = await self._register_resource_raw(
189
+ # resource_config,
190
+ # raw_results,
191
+ # user_agent_type,
192
+ # send_raw_data_examples_amount=send_raw_data_examples_amount,
193
+ # )
194
+ # errors.extend(register_errors)
195
+ # passed_entities = list(all_entities.passed)
196
+ #
197
+ # for generator in async_generators:
198
+ # try:
199
+ # async for items in generator:
200
+ # if send_raw_data_examples_amount > 0:
201
+ # send_raw_data_examples_amount = max(
202
+ # 0, send_raw_data_examples_amount - len(passed_entities)
203
+ # )
204
+ #
205
+ # entities, register_errors = await self._register_resource_raw(
206
+ # resource_config,
207
+ # items,
208
+ # user_agent_type,
209
+ # send_raw_data_examples_amount=send_raw_data_examples_amount,
210
+ # )
211
+ # errors.extend(register_errors)
212
+ # passed_entities.extend(entities.passed)
213
+ # except* OceanAbortException as error:
214
+ # errors.append(error)
215
+ #
216
+ # logger.info(
217
+ # f"Finished registering change for {len(results)} raw results for kind: {resource_config.kind}. {len(passed_entities)} entities were affected"
218
+ # )
218
219
  return passed_entities, errors
219
220
 
220
221
  async def register_raw(
@@ -426,20 +427,20 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
426
427
  use_cache=False
427
428
  )
428
429
  logger.info(f"Resync will use the following mappings: {app_config.dict()}")
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
430
+ # try:
431
+ # did_fetched_current_state = True
432
+ # entities_at_port = await ocean.port_client.search_entities(
433
+ # user_agent_type
434
+ # )
435
+ # except httpx.HTTPError as e:
436
+ # logger.warning(
437
+ # "Failed to fetch the current state of entities at Port. "
438
+ # "Skipping delete phase due to unknown initial state. "
439
+ # f"Error: {e}\n"
440
+ # f"Response status code: {e.response.status_code if isinstance(e, httpx.HTTPStatusError) else None}\n"
441
+ # f"Response content: {e.response.text if isinstance(e, httpx.HTTPStatusError) else None}\n"
442
+ # )
443
+ # did_fetched_current_state = False
443
444
 
444
445
  creation_results: list[tuple[list[Entity], list[Exception]]] = []
445
446
 
@@ -458,36 +459,36 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
458
459
  except asyncio.CancelledError as e:
459
460
  logger.warning("Resync aborted successfully, skipping delete phase. This leads to an incomplete state")
460
461
  raise
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")
462
+ # else:
463
+ # if not did_fetched_current_state:
464
+ # logger.warning(
465
+ # "Due to an error before the resync, the previous state of entities at Port is unknown."
466
+ # " Skipping delete phase due to unknown initial state."
467
+ # )
468
+ # return
469
+ #
470
+ # logger.info("Starting resync diff calculation")
471
+ # flat_created_entities, errors = zip_and_sum(creation_results) or [
472
+ # [],
473
+ # [],
474
+ # ]
475
+ #
476
+ # if errors:
477
+ # message = f"Resync failed with {len(errors)}. Skipping delete phase due to incomplete state"
478
+ # error_group = ExceptionGroup(
479
+ # f"Resync failed with {len(errors)}. Skipping delete phase due to incomplete state",
480
+ # errors,
481
+ # )
482
+ # if not silent:
483
+ # raise error_group
484
+ #
485
+ # logger.error(message, exc_info=error_group)
486
+ # else:
487
+ # logger.info(
488
+ # 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)}"
489
+ # )
490
+ # await self.entities_state_applier.delete_diff(
491
+ # {"before": entities_at_port, "after": flat_created_entities},
492
+ # user_agent_type,
493
+ # )
494
+ # logger.info("Resync finished successfully")
@@ -2,7 +2,7 @@ import asyncio
2
2
  import logging
3
3
  import sys
4
4
  import time
5
- from concurrent.futures import ThreadPoolExecutor
5
+ from concurrent.futures import ProcessPoolExecutor
6
6
  from datetime import datetime
7
7
  from logging.handlers import MemoryHandler
8
8
  from typing import Any
@@ -72,7 +72,7 @@ class HTTPMemoryHandler(MemoryHandler):
72
72
  self._serialized_buffer.clear()
73
73
  self.last_flush_time = time.time()
74
74
  loop = asyncio.new_event_loop()
75
- with ThreadPoolExecutor() as executor:
75
+ with ProcessPoolExecutor() as executor:
76
76
  executor.submit(
77
77
  lambda: asyncio.run_coroutine_threadsafe(
78
78
  self.send_logs(self.ocean, logs), loop
port_ocean/ocean.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import asyncio
2
2
  import sys
3
- from concurrent.futures import ThreadPoolExecutor
3
+ from concurrent.futures import ProcessPoolExecutor
4
4
  from contextlib import asynccontextmanager
5
5
  from typing import Callable, Any, Dict, AsyncIterator, Type
6
6
 
@@ -93,7 +93,7 @@ class Ocean:
93
93
  raise e
94
94
 
95
95
  def pool_executor_wrapper(event_loop) -> None:
96
- with ThreadPoolExecutor() as executor:
96
+ with ProcessPoolExecutor() as executor:
97
97
  e = executor.submit(lambda: asyncio.run_coroutine_threadsafe(
98
98
  execute_resync_all(), event_loop
99
99
  ))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.12.2.dev1
3
+ Version: 0.12.2.dev3
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
@@ -65,7 +65,7 @@ port_ocean/core/defaults/clean.py,sha256=S3UAfca-oU89WJKIB4OgGjGjPr0vxBQ2aRZsLTZ
65
65
  port_ocean/core/defaults/common.py,sha256=uVUg6VEn4RqtXQwLwMNGfkmT5zYRN_h5USfKw3poVyo,3561
66
66
  port_ocean/core/defaults/initialize.py,sha256=qg4JLIWjp0c5-9w09X99muHRYX4k1cGZ_77vYo-tnpU,8422
67
67
  port_ocean/core/event_listener/__init__.py,sha256=mzJ33wRq0kh60fpVdOHVmvMTUQIvz3vxmifyBgwDn0E,889
68
- port_ocean/core/event_listener/base.py,sha256=meO-SidN-7-KmwUhicUzXm1NHVC9-LyDXGhnPVnzIZw,2717
68
+ port_ocean/core/event_listener/base.py,sha256=tc7NHg-Vvt8M4iVIBrJvkecVTmTDGE1r-bjMQZpK_ME,2719
69
69
  port_ocean/core/event_listener/factory.py,sha256=AYYfSHPAF7P5H-uQECXT0JVJjKDHrYkWJJBSL4mGkg8,3697
70
70
  port_ocean/core/event_listener/http.py,sha256=N8HrfFqR3KGKz96pWdp_pP-m30jGtcz_1CkijovkBN8,2565
71
71
  port_ocean/core/event_listener/kafka.py,sha256=ulidnp4sz-chXwHsbH9JayVjcxy_mG6ts_Im3YKmLpI,6983
@@ -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=BGS5EnZ2N3ifcAi94Wo-ZassSJ-_Se9eFJMpBDT7pNY,18841
97
+ port_ocean/core/integrations/mixins/sync_raw.py,sha256=uJpcCDYXkS42snXkt6LXWTCO14xhQDWUDwJEEdRXAMk,19109
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
@@ -111,11 +111,11 @@ port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
111
111
  port_ocean/helpers/async_client.py,sha256=SRlP6o7_FCSY3UHnRlZdezppePVxxOzZ0z861vE3K40,1783
112
112
  port_ocean/helpers/retry.py,sha256=IQ0RfQ2T5o6uoZh2WW2nrFH5TT6K_k3y2Im0HDp5j9Y,15059
113
113
  port_ocean/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
- port_ocean/log/handlers.py,sha256=afTTD4c_wlv5Ugp5dDrdBV6D91_a8SbeD6QjvNuLDYk,2859
114
+ port_ocean/log/handlers.py,sha256=Br_1aujTmMkT15DbZj1E-mg0sHauvtKQB4E9-SDypmE,2861
115
115
  port_ocean/log/logger_setup.py,sha256=BaXt-mh9CVXhneh37H46d04lqOdIBixG1pFyGfotuZs,2328
116
116
  port_ocean/log/sensetive.py,sha256=lVKiZH6b7TkrZAMmhEJRhcl67HNM94e56x12DwFgCQk,2920
117
117
  port_ocean/middlewares.py,sha256=9wYCdyzRZGK1vjEJ28FY_DkfwDNENmXp504UKPf5NaQ,2727
118
- port_ocean/ocean.py,sha256=5_TWyZ4qnTvJ90gx9NGir9aLkt4UzYYHvUN4kTjS1ao,5225
118
+ port_ocean/ocean.py,sha256=ZPIRXqBF2WB3-tLsOwRnbFioGzGh2iRadK7YgYP1rpM,5227
119
119
  port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
120
  port_ocean/run.py,sha256=rTxBlrQd4yyrtgErCFJCHCEHs7d1OXrRiJehUYmIbN0,2212
121
121
  port_ocean/sonar-project.properties,sha256=X_wLzDOkEVmpGLRMb2fg9Rb0DxWwUFSvESId8qpvrPI,73
@@ -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.dev1.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
144
- port_ocean-0.12.2.dev1.dist-info/METADATA,sha256=B4fcje8vn0RFBIoR7DGLB3wkqsFCNkY_FqjL-MV0Q9Y,6619
145
- port_ocean-0.12.2.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
146
- port_ocean-0.12.2.dev1.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
147
- port_ocean-0.12.2.dev1.dist-info/RECORD,,
143
+ port_ocean-0.12.2.dev3.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
144
+ port_ocean-0.12.2.dev3.dist-info/METADATA,sha256=_xCDGNZxbMAPgCdhpvjDlFj1Bm-R9x26E6nXNcIUai4,6619
145
+ port_ocean-0.12.2.dev3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
146
+ port_ocean-0.12.2.dev3.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
147
+ port_ocean-0.12.2.dev3.dist-info/RECORD,,