mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added dan's changes
This commit is contained in:
parent
414bdc6431
commit
33d355e2c3
3 changed files with 6 additions and 13 deletions
2
.github/workflows/deploy_terraform.yml
vendored
2
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -417,7 +417,7 @@ jobs:
|
|||
# Deploy FastAPI Lambda
|
||||
# ============================================================
|
||||
fast_api_lambda:
|
||||
needs: [determine_stage, ara_engine_lambda, categorisation_lambda]
|
||||
needs: [determine_stage, ara_engine_lambda, categorisation_lambda, postcodeSplitter_lambda]
|
||||
uses: ./.github/workflows/_deploy_lambda.yml
|
||||
with:
|
||||
lambda_name: ara_fast_api
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import boto3
|
||||
import json
|
||||
from uuid import UUID
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlmodel import select
|
||||
|
|
@ -8,7 +7,7 @@ from backend.app.dependencies import validate_token
|
|||
from backend.app.config import get_settings
|
||||
from backend.app.db.connection import get_db_session
|
||||
from backend.app.db.models.bulk_address_uploads import BulkAddressUpload
|
||||
from backend.app.bulk_uploads.schema import TriggerSplitterRequest
|
||||
from backend.app.bulk_uploads.schema import PostcodeSplitterTriggerRequest
|
||||
from utils.s3 import parse_s3_uri, read_csv_from_s3
|
||||
|
||||
|
||||
|
|
@ -19,21 +18,15 @@ router = APIRouter(
|
|||
)
|
||||
|
||||
|
||||
@router.post("/trigger-splitter", status_code=202)
|
||||
async def trigger_splitter(req: TriggerSplitterRequest):
|
||||
@router.post("/trigger-postcode-splitter", status_code=202)
|
||||
async def trigger_postcode_splitter(req: PostcodeSplitterTriggerRequest):
|
||||
settings = get_settings()
|
||||
|
||||
sqs_payload = {
|
||||
"task_id": req.task_id,
|
||||
"sub_task_id": req.sub_task_id,
|
||||
"s3_uri": req.s3_uri,
|
||||
}
|
||||
|
||||
try:
|
||||
sqs = boto3.client("sqs", settings.AWS_DEFAULT_REGION)
|
||||
response = sqs.send_message(
|
||||
QueueUrl=settings.POSTCODE_SPLITTER_SQS_URL,
|
||||
MessageBody=json.dumps(sqs_payload),
|
||||
MessageBody=req.model_dump_json(),
|
||||
)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"SQS error: {e}")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class TriggerSplitterRequest(BaseModel):
|
||||
class PostcodeSplitterTriggerRequest(BaseModel):
|
||||
task_id: str
|
||||
sub_task_id: str
|
||||
s3_uri: str
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue