Skip to content

Commit 774e6f9

Browse files
authored
Merge pull request #6 from port-labs/dev
Ehanced Logs
2 parents aeb3cfd + a9bfeb6 commit 774e6f9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

integration/main.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def remove_symbols_and_title_case(input_string: str) -> str:
3838
return title_case_string
3939

4040
async def sync_applications(self) -> None:
41-
logger.info("Started syncing applications")
41+
logger.info(f"Syncing entities for blueprint {BLUEPRINT.APPLICATION}")
4242
applications = await self.humanitec_client.get_all_applications()
4343

4444
def create_entity(application):
@@ -58,9 +58,10 @@ def create_entity(application):
5858
]
5959

6060
await asyncio.gather(*tasks)
61+
logger.info(f"Finished syncing entities for blueprint {BLUEPRINT.APPLICATION}")
6162

6263
async def sync_environments(self) -> None:
63-
64+
logger.info(f"Syncing entities for blueprint {BLUEPRINT.ENVIRONMENT}")
6465
applications = await self.humanitec_client.get_all_applications()
6566

6667
def create_entity(application, environment):
@@ -95,8 +96,10 @@ def create_entity(application, environment):
9596
for environment in environments
9697
]
9798
await asyncio.gather(*tasks)
99+
logger.info(f"Finished syncing entities for blueprint {BLUEPRINT.ENVIRONMENT}")
98100

99101
async def sync_workloads(self):
102+
logger.info(f"Syncing entities for blueprint {BLUEPRINT.WORKLOAD}")
100103
def create_workload_entity(resource):
101104
return {
102105
"identifier": resource["res_id"].replace("modules.", ""),
@@ -124,9 +127,6 @@ def create_workload_entity(resource):
124127
resources = await self.humanitec_client.get_all_resources(
125128
application, environment
126129
)
127-
logger.info(
128-
f"Received resources batch with size {len(resources)} from app: {application['name']} and env: {environment['name']}"
129-
)
130130
resource_group = humanitec_client.group_resources_by_type(resources)
131131
tasks = [
132132
self.port_client.upsert_entity(
@@ -137,8 +137,10 @@ def create_workload_entity(resource):
137137
if resource and resource["type"] == "workload"
138138
]
139139
await asyncio.gather(*tasks)
140+
logger.info(f"Finished syncing entities for blueprint {BLUEPRINT.WORKLOAD}")
140141

141142
async def sync_resource_graphs(self) -> None:
143+
logger.info(f"Syncing entities for blueprint {BLUEPRINT.RESOURCE_GRAPH}")
142144
def get_resource_graph_request_body(modules):
143145
return [
144146
{
@@ -207,6 +209,7 @@ def create_resource_graph_entity(graph_data, include_relations):
207209
for graph_data in resource_graph
208210
]
209211
await asyncio.gather(*tasks)
212+
logger.info(f"Finished syncing entities for blueprint {BLUEPRINT.RESOURCE_GRAPH}")
210213

211214
async def enrich_resource_with_graph(self, resource, application, environment):
212215
data = {
@@ -224,6 +227,7 @@ async def enrich_resource_with_graph(self, resource, application, environment):
224227
return resource
225228

226229
async def sync_resources(self) -> None:
230+
logger.info(f"Syncing entities for blueprint {BLUEPRINT.RESOURCE}")
227231
def create_resource_entity(resource):
228232
workload_id = (
229233
resource["res_id"].split(".")[1]
@@ -284,6 +288,7 @@ async def fetch_resources(application, environment):
284288
for resource in all_resources
285289
]
286290
await asyncio.gather(*entity_tasks)
291+
logger.info(f"Finished syncing entities for blueprint {BLUEPRINT.RESOURCE}")
287292

288293
async def sync_all(self) -> None:
289294
await self.sync_applications()

0 commit comments

Comments
 (0)