From 7ef40940840f3383e320bbd0d7422f2226ad92d7 Mon Sep 17 00:00:00 2001 From: Tom Tankilevitch <59158507+Tankilevitch@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:56:41 +0200 Subject: [PATCH] Support creation of blueprints with aggregation properties & Change entity from optional to required in port app config (#287) --- CHANGELOG.md | 8 ++++++++ port_ocean/clients/port/mixins/entities.py | 2 +- port_ocean/clients/port/utils.py | 19 ++++++++++--------- port_ocean/core/defaults/initialize.py | 1 + .../core/handlers/port_app_config/models.py | 4 ++-- pyproject.toml | 2 +- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 657a650a62..78c48105ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## 0.4.11 (2023-12-21) + +### Improvements + +- Added handling for aggregation properties when initializing the integration, so it will patch the aggregation properties after creating the relations (PORT-5717) +- Changed entity property in the `portResourceConfig` to be required instead of optional, as we don't support creation of blueprints as part of the app config (PORT-4549) + + ## 0.4.10 (2023-12-21) diff --git a/port_ocean/clients/port/mixins/entities.py b/port_ocean/clients/port/mixins/entities.py index 44f096df9c..af406c41f5 100644 --- a/port_ocean/clients/port/mixins/entities.py +++ b/port_ocean/clients/port/mixins/entities.py @@ -101,7 +101,7 @@ async def delete_entity( if response.is_error: if response.status_code == 404: logger.info( - f"Weren't able to delete entity: {entity.identifier} of blueprint: {entity.blueprint}," + f"Failed to delete entity: {entity.identifier} of blueprint: {entity.blueprint}," f" as it was already deleted from port" ) return diff --git a/port_ocean/clients/port/utils.py b/port_ocean/clients/port/utils.py index 52edbfc78d..2bbc3359dc 100644 --- a/port_ocean/clients/port/utils.py +++ b/port_ocean/clients/port/utils.py @@ -10,17 +10,21 @@ if TYPE_CHECKING: from port_ocean.clients.port.client import PortClient -# In case the framework sends more requests to port in parallel then allowed by the limits, a PoolTimeout exception will +# In case the framework sends more requests to port in parallel than allowed by the limits, a PoolTimeout exception will # be raised. # Raising defaults for the timeout, in addition to the limits, will allow request to wait for a connection for a longer # period of time, before raising an exception. -# We don't want to set the max_connections too highly, as it will cause the application to run out of memory. -# We also don't want to set the max_keepalive_connections too highly, as it will cause the application to run out of -# available connections. +# The max_connections value can't be too high, as it will cause the application to run out of memory. +# The max_keepalive_connections can't be too high, as it will cause the application to run out of available connections. PORT_HTTP_MAX_CONNECTIONS_LIMIT = 200 PORT_HTTP_MAX_KEEP_ALIVE_CONNECTIONS = 50 PORT_HTTP_TIMEOUT = 10.0 +PORT_HTTPX_TIMEOUT = httpx.Timeout(PORT_HTTP_TIMEOUT) +PORT_HTTPX_LIMITS = httpx.Limits( + max_connections=PORT_HTTP_MAX_CONNECTIONS_LIMIT, + max_keepalive_connections=PORT_HTTP_MAX_KEEP_ALIVE_CONNECTIONS, +) _http_client: LocalStack[httpx.AsyncClient] = LocalStack() @@ -31,11 +35,8 @@ def _get_http_client_context(port_client: "PortClient") -> httpx.AsyncClient: client = OceanAsyncClient( TokenRetryTransport, transport_kwargs={"port_client": port_client}, - timeout=httpx.Timeout(PORT_HTTP_TIMEOUT), - limits=httpx.Limits( - max_connections=PORT_HTTP_MAX_CONNECTIONS_LIMIT, - max_keepalive_connections=PORT_HTTP_MAX_KEEP_ALIVE_CONNECTIONS, - ), + timeout=PORT_HTTPX_TIMEOUT, + limits=PORT_HTTPX_LIMITS, ) _http_client.push(client) diff --git a/port_ocean/core/defaults/initialize.py b/port_ocean/core/defaults/initialize.py index d91984a3f6..ed7b5ee065 100644 --- a/port_ocean/core/defaults/initialize.py +++ b/port_ocean/core/defaults/initialize.py @@ -33,6 +33,7 @@ def deconstruct_blueprints_to_creation_steps( blueprint.pop("calculationProperties", {}) blueprint.pop("mirrorProperties", {}) + blueprint.pop("aggregationProperties", {}) with_relations.append(blueprint.copy()) blueprint.pop("teamInheritance", {}) diff --git a/port_ocean/core/handlers/port_app_config/models.py b/port_ocean/core/handlers/port_app_config/models.py index 590fbb06ec..3be3481d98 100644 --- a/port_ocean/core/handlers/port_app_config/models.py +++ b/port_ocean/core/handlers/port_app_config/models.py @@ -1,4 +1,4 @@ -from typing import Optional, Any +from typing import Any from pydantic import BaseModel, Field @@ -17,7 +17,7 @@ class PortResourceConfig(BaseModel): class MappingsConfig(BaseModel): mappings: EntityMapping - entity: Optional[MappingsConfig] + entity: MappingsConfig class Selector(BaseModel): diff --git a/pyproject.toml b/pyproject.toml index 6752a01065..3713ca2f86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.4.10" +version = "0.4.11" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"