Skip to content

Commit

Permalink
ocean10
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 committed Oct 12, 2024
1 parent c6048a2 commit 34c0dfe
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 44 deletions.
85 changes: 42 additions & 43 deletions port_ocean/core/integrations/mixins/sync_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import typing
from typing import Callable, Awaitable, Any

import httpx
from loguru import logger

from port_ocean.clients.port.types import UserAgentType
Expand Down Expand Up @@ -174,48 +173,48 @@ async def _register_in_batches(
) -> tuple[list[Entity], list[Exception]]:
results, errors = await self._get_resource_raw_results(resource_config)
passed_entities = []
# async_generators: list[ASYNC_GENERATOR_RESYNC_TYPE] = []
# raw_results: RAW_RESULT = []
# for result in results:
# if isinstance(result, dict):
# raw_results.append(result)
# else:
# async_generators.append(result)
#
# send_raw_data_examples_amount = (
# SEND_RAW_DATA_EXAMPLES_AMOUNT if ocean.config.send_raw_data_examples else 0
# )
# all_entities, register_errors = await self._register_resource_raw(
# resource_config,
# raw_results,
# user_agent_type,
# send_raw_data_examples_amount=send_raw_data_examples_amount,
# )
# errors.extend(register_errors)
# passed_entities = list(all_entities.passed)
#
# for generator in async_generators:
# try:
# async for items in generator:
# if send_raw_data_examples_amount > 0:
# send_raw_data_examples_amount = max(
# 0, send_raw_data_examples_amount - len(passed_entities)
# )
#
# entities, register_errors = await self._register_resource_raw(
# resource_config,
# items,
# user_agent_type,
# send_raw_data_examples_amount=send_raw_data_examples_amount,
# )
# errors.extend(register_errors)
# passed_entities.extend(entities.passed)
# except* OceanAbortException as error:
# errors.append(error)
#
# logger.info(
# f"Finished registering change for {len(results)} raw results for kind: {resource_config.kind}. {len(passed_entities)} entities were affected"
# )
async_generators: list[ASYNC_GENERATOR_RESYNC_TYPE] = []
raw_results: RAW_RESULT = []
for result in results:
if isinstance(result, dict):
raw_results.append(result)
else:
async_generators.append(result)

send_raw_data_examples_amount = (
SEND_RAW_DATA_EXAMPLES_AMOUNT if ocean.config.send_raw_data_examples else 0
)
all_entities, register_errors = await self._register_resource_raw(
resource_config,
raw_results,
user_agent_type,
send_raw_data_examples_amount=send_raw_data_examples_amount,
)
errors.extend(register_errors)
passed_entities = list(all_entities.passed)

for generator in async_generators:
try:
async for items in generator:
if send_raw_data_examples_amount > 0:
send_raw_data_examples_amount = max(
0, send_raw_data_examples_amount - len(passed_entities)
)

# entities, register_errors = await self._register_resource_raw(
# resource_config,
# items,
# user_agent_type,
# send_raw_data_examples_amount=send_raw_data_examples_amount,
# )
# errors.extend(register_errors)
# passed_entities.extend(entities.passed)
except* OceanAbortException as error:
errors.append(error)

logger.info(
f"Finished registering change for {len(results)} raw results for kind: {resource_config.kind}. {len(passed_entities)} entities were affected"
)
return passed_entities, errors

async def register_raw(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "port-ocean"
version = "0.12.2-dev07"
version = "0.12.2-dev10"
description = "Port Ocean is a CLI tool for managing your Port projects."
readme = "README.md"
homepage = "https://app.getport.io"
Expand Down

0 comments on commit 34c0dfe

Please sign in to comment.