Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 35e567b

Browse files
authored
Cdifonzo/multi index testing (#162)
1 parent c7149da commit 35e567b

30 files changed

+2849
-3313
lines changed

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at
1414

1515
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
1616

17-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
1818

1919
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
2020

backend/manage-indexing-jobs.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,12 @@ def main():
9595
)
9696
exit()
9797
if item["status"] == PipelineJobState.SCHEDULED.value:
98-
job_metadata.append(
99-
{
100-
"human_readable_index_name": item["human_readable_index_name"],
101-
"epoch_request_time": item["epoch_request_time"],
102-
"status": item["status"],
103-
"percent_complete": item["percent_complete"],
104-
}
105-
)
98+
job_metadata.append({
99+
"human_readable_index_name": item["human_readable_index_name"],
100+
"epoch_request_time": item["epoch_request_time"],
101+
"status": item["status"],
102+
"percent_complete": item["percent_complete"],
103+
})
106104
# exit if no jobs found
107105
if not job_metadata:
108106
print("No jobs found")

backend/src/api/common.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33

44
import hashlib
55
import re
6-
from typing import Annotated
76

8-
from fastapi import (
9-
Header,
10-
HTTPException,
11-
)
7+
from fastapi import HTTPException
128

139
from src.api.azure_clients import (
1410
AzureStorageClientManager,
@@ -188,14 +184,3 @@ def retrieve_original_entity_config_name(sanitized_name: str) -> str | None:
188184
status_code=500, detail="Error retrieving original entity config name."
189185
)
190186
return None
191-
192-
193-
async def verify_subscription_key_exist(
194-
Ocp_Apim_Subscription_Key: Annotated[str, Header()],
195-
):
196-
# a function that will be injected as a dependency to API routes - it will be called to verify the Ocp_Apim_Subscription_Key is present
197-
if not Ocp_Apim_Subscription_Key:
198-
raise HTTPException(
199-
status_code=400, detail="Ocp-Apim-Subscription-Key required"
200-
)
201-
return Ocp_Apim_Subscription_Key

backend/src/api/data.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
# Licensed under the MIT License.
33

44
import asyncio
5-
import os
65
import re
76
from math import ceil
87
from typing import List
98

109
from azure.storage.blob import ContainerClient
1110
from fastapi import (
1211
APIRouter,
13-
Depends,
1412
HTTPException,
1513
UploadFile,
1614
)
@@ -23,7 +21,6 @@
2321
delete_blob_container,
2422
sanitize_name,
2523
validate_blob_container_name,
26-
verify_subscription_key_exist,
2724
)
2825
from src.models import (
2926
BaseResponse,
@@ -38,9 +35,6 @@
3835
tags=["Data Management"],
3936
)
4037

41-
if os.getenv("KUBERNETES_SERVICE_HOST"):
42-
data_route.dependencies.append(Depends(verify_subscription_key_exist))
43-
4438

4539
@data_route.get(
4640
"",
@@ -165,7 +159,6 @@ async def upload_files(
165159
batches = ceil(len(files) / batch_size)
166160
for i in range(batches):
167161
batch_files = files[i * batch_size : (i + 1) * batch_size]
168-
print(f"Uploading batch {i+1} of {batches}...")
169162
tasks = [
170163
upload_file_async(file, container_client, overwrite)
171164
for file in batch_files
@@ -177,13 +170,11 @@ async def upload_files(
177170
database_name="graphrag", container_name="container-store"
178171
)
179172
)
180-
container_store_client.upsert_item(
181-
{
182-
"id": sanitized_storage_name,
183-
"human_readable_name": storage_name,
184-
"type": "data",
185-
}
186-
)
173+
container_store_client.upsert_item({
174+
"id": sanitized_storage_name,
175+
"human_readable_name": storage_name,
176+
"type": "data",
177+
})
187178
return BaseResponse(status="File upload successful.")
188179
except Exception:
189180
reporter.on_error("Error uploading files.", details={"files": files})

backend/src/api/experimental.py

Lines changed: 0 additions & 200 deletions
This file was deleted.

backend/src/api/graph.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
import os
54
from io import BytesIO
65

76
import networkx as nx
87
from fastapi import (
98
APIRouter,
10-
Depends,
119
HTTPException,
1210
)
1311
from fastapi.responses import StreamingResponse
@@ -16,7 +14,6 @@
1614
from src.api.common import (
1715
sanitize_name,
1816
validate_index_file_exist,
19-
verify_subscription_key_exist,
2017
)
2118
from src.models import GraphDataResponse
2219
from src.reporting import ReporterSingleton
@@ -29,9 +26,6 @@
2926
tags=["Graph Operations"],
3027
)
3128

32-
if os.getenv("KUBERNETES_SERVICE_HOST"):
33-
graph_route.dependencies.append(Depends(verify_subscription_key_exist))
34-
3529

3630
@graph_route.get(
3731
"/graphml/{index_name}",

backend/src/api/index.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from datashaper import WorkflowCallbacksManager
1515
from fastapi import (
1616
APIRouter,
17-
Depends,
1817
HTTPException,
1918
UploadFile,
2019
)
@@ -36,7 +35,6 @@
3635
delete_blob_container,
3736
sanitize_name,
3837
validate_blob_container_name,
39-
verify_subscription_key_exist,
4038
)
4139
from src.models import (
4240
BaseResponse,
@@ -63,9 +61,6 @@
6361
tags=["Index Operations"],
6462
)
6563

66-
if os.getenv("KUBERNETES_SERVICE_HOST"):
67-
index_route.dependencies.append(Depends(verify_subscription_key_exist))
68-
6964

7065
@index_route.post(
7166
"",
@@ -172,13 +167,11 @@ async def _start_indexing_pipeline(index_name: str):
172167
container_store_client = get_database_container_client(
173168
database_name="graphrag", container_name="container-store"
174169
)
175-
container_store_client.upsert_item(
176-
{
177-
"id": sanitized_index_name,
178-
"human_readable_name": index_name,
179-
"type": "index",
180-
}
181-
)
170+
container_store_client.upsert_item({
171+
"id": sanitized_index_name,
172+
"human_readable_name": index_name,
173+
"type": "index",
174+
})
182175

183176
reporter = ReporterSingleton().get_instance()
184177
pipelinejob = PipelineJob()

0 commit comments

Comments
 (0)