Skip to content

Commit

Permalink
Support creation of blueprints with aggregation properties & Change e…
Browse files Browse the repository at this point in the history
…ntity from optional to required in port app config (#287)
  • Loading branch information
Tankilevitch authored Dec 21, 2023
1 parent 450f1b0 commit 7ef4094
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

<!-- towncrier release notes start -->

## 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)


Expand Down
2 changes: 1 addition & 1 deletion port_ocean/clients/port/mixins/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions port_ocean/clients/port/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)

Expand Down
1 change: 1 addition & 0 deletions port_ocean/core/defaults/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", {})
Expand Down
4 changes: 2 additions & 2 deletions port_ocean/core/handlers/port_app_config/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Any
from typing import Any

from pydantic import BaseModel, Field

Expand All @@ -17,7 +17,7 @@ class PortResourceConfig(BaseModel):
class MappingsConfig(BaseModel):
mappings: EntityMapping

entity: Optional[MappingsConfig]
entity: MappingsConfig


class Selector(BaseModel):
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.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"
Expand Down

0 comments on commit 7ef4094

Please sign in to comment.