Skip to content

Commit 365738c

Browse files
author
Shreyas-Microsoft
committed
Merge down from hotfix
2 parents e09573d + 9b0194b commit 365738c

9 files changed

Lines changed: 30 additions & 23 deletions

File tree

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
max-line-length = 88
33
extend-ignore = E501
44
exclude = .venv, frontend
5-
ignore = E203, W503, G004, G200,B008,ANN,D100,D101,D102,D103,D104,D105,D106,D107
5+
ignore = E203, W503, G004, G200,B008,ANN,D100,D101,D102,D103,D104,D105,D106,D107,D205,D400,D401,D200

src/backend/api/api_routes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
import io
55
import zipfile
66

7+
from api.auth.auth_utils import get_authenticated_user
8+
from api.status_updates import app_connection_manager, close_connection
9+
10+
from common.logger.app_logger import AppLogger
11+
from common.services.batch_service import BatchService
12+
713
from fastapi import (
814
APIRouter,
915
File,
@@ -16,17 +22,11 @@
1622
)
1723
from fastapi.responses import Response
1824

19-
from api.auth.auth_utils import get_authenticated_user
20-
from api.status_updates import app_connection_manager, close_connection
21-
from common.logger.app_logger import AppLogger
22-
from common.services.batch_service import BatchService
2325
from sql_agents.process_batch import process_batch_async
2426

2527
router = APIRouter()
2628
logger = AppLogger("APIRoutes")
2729

28-
# start processing the batch
29-
# from sql_agents_start import process_batch_async # noqa: E402
3030

3131
# start processing the batch
3232
@router.post("/start-processing")

src/backend/common/config/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from azure.identity.aio import ClientSecretCredential, DefaultAzureCredential
1818

1919

20-
2120
class Config:
2221
"""Configuration class for the application."""
2322

src/backend/common/database/database_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
from abc import ABC, abstractmethod
55
from typing import Dict, List, Optional
66

7-
from common.models.api import AgentType, BatchRecord, FileRecord, LogType
7+
from common.models.api import BatchRecord, FileRecord, LogType
88

99
from semantic_kernel.contents import AuthorRole
1010

11-
from common.models.api import BatchRecord, FileRecord, LogType
1211
from sql_agents.helpers.models import AgentType
1312

1413

src/backend/sql_agents/agents/agent_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ResponseFormatJsonSchema,
99
ResponseFormatJsonSchemaType,
1010
)
11+
1112
from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent
1213
from semantic_kernel.functions import KernelArguments
1314

src/backend/sql_agents/convert_script.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
import json
88
import logging
99

10-
from semantic_kernel.contents import AuthorRole, ChatMessageContent
11-
1210
from api.status_updates import send_status_update
11+
1312
from common.models.api import (
1413
FileProcessUpdate,
1514
FileRecord,
@@ -18,6 +17,9 @@
1817
ProcessStatus,
1918
)
2019
from common.services.batch_service import BatchService
20+
21+
from semantic_kernel.contents import AuthorRole, ChatMessageContent
22+
2123
from sql_agents.agents.fixer.response import FixerResponse
2224
from sql_agents.agents.migrator.response import MigratorResponse
2325
from sql_agents.agents.picker.response import PickerResponse

src/backend/sql_agents/helpers/agents_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def __init__(self):
3333
@classmethod
3434
async def create(cls, config: AgentBaseConfig):
3535
"""Create the SQL agents for migration.
36-
Required as init cannot be async"""
36+
Required as init cannot be async
37+
"""
3738
self = cls() # Create an instance
3839
try:
3940
self.agent_config = config
@@ -71,7 +72,7 @@ def idx_agents(self):
7172
}
7273

7374
async def delete_agents(self):
74-
"""cleans up the agents from Azure Foundry"""
75+
"""Cleans up the agents from Azure Foundry"""
7576
try:
7677
for agent in self.agents:
7778
await self.agent_config.ai_project_client.agents.delete_agent(agent.id)

src/backend/sql_agents/helpers/comms_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class SelectionStrategy(SequentialSelectionStrategy):
2020

2121
# Select the next agent that should take the next turn in the chat
2222
async def select_agent(self, agents, history):
23-
""" "Check which agent should take the next turn in the chat."""
24-
23+
"""Check which agent should take the next turn in the chat."""
2524
match history[-1].name:
2625
case AgentType.MIGRATOR.value:
2726
# The Migrator should go first

src/backend/sql_agents/process_batch.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66

77
import logging
88

9+
from api.status_updates import send_status_update
10+
911
from azure.identity.aio import DefaultAzureCredential
10-
from fastapi import HTTPException
11-
from semantic_kernel.agents import AzureAIAgent # pylint: disable=E0611
12-
from semantic_kernel.contents import AuthorRole
13-
from semantic_kernel.exceptions.service_exceptions import ServiceResponseException
1412

15-
from api.status_updates import send_status_update
1613
from common.models.api import (
1714
FileProcessUpdate,
1815
FileRecord,
@@ -22,6 +19,15 @@
2219
)
2320
from common.services.batch_service import BatchService
2421
from common.storage.blob_factory import BlobStorageFactory
22+
23+
from fastapi import HTTPException
24+
25+
26+
from semantic_kernel.agents import AzureAIAgent # pylint: disable=E0611
27+
from semantic_kernel.contents import AuthorRole
28+
from semantic_kernel.exceptions.service_exceptions import ServiceResponseException
29+
30+
2531
from sql_agents.agents.agent_config import AgentBaseConfig
2632
from sql_agents.convert_script import convert_script
2733
from sql_agents.helpers.agents_manager import SqlAgents
@@ -36,7 +42,7 @@
3642
async def process_batch_async(
3743
batch_id: str, convert_from: str = "informix", convert_to: str = "tsql"
3844
):
39-
"""central batch processing function to process each file in the batch"""
45+
"""Central batch processing function to process each file in the batch"""
4046
logger.info("Processing batch: %s", batch_id)
4147
storage = await BlobStorageFactory.get_storage()
4248
batch_service = BatchService()
@@ -154,7 +160,7 @@ async def process_batch_async(
154160
async def process_error(
155161
ex: Exception, file_record: FileRecord, batch_service: BatchService
156162
):
157-
"""insert data base write to file record stating invalid file and send ws notification"""
163+
"""Insert data base write to file record stating invalid file and send ws notification"""
158164
await batch_service.create_file_log(
159165
file_id=str(file_record.file_id),
160166
description=f"Error processing file {ex}",

0 commit comments

Comments
 (0)