From d5e83af467643a57dbfc525093be81411276f4e7 Mon Sep 17 00:00:00 2001 From: dx-tan Date: Mon, 11 Dec 2023 06:36:49 +0000 Subject: [PATCH] Fix: FE issues --- cope2n-api/fwd_api/api/ctel_view.py | 5 ++-- cope2n-fe/src/requests/kie.ts | 2 +- docker-compose.yml | 43 ++++++++++++++--------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/cope2n-api/fwd_api/api/ctel_view.py b/cope2n-api/fwd_api/api/ctel_view.py index fa19598..bd454d9 100755 --- a/cope2n-api/fwd_api/api/ctel_view.py +++ b/cope2n-api/fwd_api/api/ctel_view.py @@ -466,7 +466,8 @@ class CtelViewSet(viewsets.ViewSet): empty_data = serializer.data[0] empty_data["data"] = None return Response(status=status.HTTP_200_OK, data=empty_data) - + data = serializer.data[0] + data["status"] = "3" return Response(status=status.HTTP_200_OK, data=serializer.data[0]) @throw_on_failure(InvalidException(excArgs='data')) @@ -570,4 +571,4 @@ class CtelViewSet(viewsets.ViewSet): ProcessUtil.send_to_queue2(rq_id, sub.id, b_url, user.id, p_type) return JsonResponse(status=status.HTTP_200_OK, data={"request_id": rq_id}) - return JsonResponse(status=status.HTTP_502_BAD_GATEWAY, data={"message": "unknown_error"}) \ No newline at end of file + return JsonResponse(status=status.HTTP_502_BAD_GATEWAY, data={"message": "unknown_error"}) diff --git a/cope2n-fe/src/requests/kie.ts b/cope2n-fe/src/requests/kie.ts index 10cc02a..89d2bd2 100644 --- a/cope2n-fe/src/requests/kie.ts +++ b/cope2n-fe/src/requests/kie.ts @@ -7,7 +7,7 @@ import { import { API } from './api'; export async function getKieJob(requestId: string) { - const response = await API.get>(`/ctel/result/${requestId}`); + const response = await API.get>(`/ctel/result/${requestId}/`); // const response = await API.get>(`/ctel/result/SAP3ad4bb28771044eaa6e1a2d06dcc8f5e`); return response.data; } diff --git a/docker-compose.yml b/docker-compose.yml index 852dfcd..cea3ad0 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,19 +5,19 @@ networks: driver: bridge services: - cope2n-fi-manulife-sbt: + cope2n-fi-sbt: build: context: cope2n-ai-fi shm_size: 10gb dockerfile: Dockerfile shm_size: 10gb image: sidp/cope2n-ai-fi-sbt - # container_name: "sidp-cope2n-ai-fi-manulife-sbt" + # container_name: "sidp-cope2n-ai-fi-sbt" networks: - ctel-sbt privileged: true environment: - - CELERY_BROKER=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-manulife-sbt:5672 + - CELERY_BROKER=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672 - CUDA_VISIBLE_DEVICES=0 volumes: - ./cope2n-ai-fi:/workspace/cope2n-ai-fi # for dev container only @@ -35,14 +35,14 @@ services: mode: replicated replicas: 2 # Back-end services - be-ctel-manulife-sbt: + be-ctel-sbt: build: context: cope2n-api dockerfile: Dockerfile ports: - 9880:9000 image: sidp/cope2n-be-fi-sbt - # container_name: "sidp-cope2n-be-ctel-manulife-sbt" + # container_name: "sidp-cope2n-be-ctel-sbt" environment: - MEDIA_ROOT=${MEDIA_ROOT} - DB_ENGINE=${DB_ENGINE} @@ -57,8 +57,8 @@ services: - CTEL_KEY=${CTEL_KEY} - SECRET_KEY=${SECRET_KEY} - ALLOWED_HOSTS=${ALLOWED_HOSTS} - - BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-manulife-sbt:5672 - - BASE_URL=http://be-ctel-manulife-sbt:${BASE_PORT} + - BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672 + - BASE_URL=http://be-ctel-sbt:${BASE_PORT} - BASE_UI_URL=http://fe:${VITE_PORT} - AUTH_TOKEN_LIFE_TIME=${AUTH_TOKEN_LIFE_TIME} - IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME} @@ -82,8 +82,7 @@ services: # condition: service_started # rabbitmq: # condition: service_started - command: sh -c "python manage.py collectstatic --no-input && - python manage.py makemigrations && + command: sh -c "python manage.py collectstatic --no-input && python manage.py migrate && python manage.py compilemessages && gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker -b 0.0.0.0:9000" # pre-makemigrations on prod @@ -103,7 +102,7 @@ services: # - ctel-sbt #command: server --address :9884 --console-address :9885 /data - be-celery-manulife-sbt: + be-celery-sbt: # build: # context: cope2n-api # dockerfile: Dockerfile @@ -111,7 +110,7 @@ services: # - "UID=${UID:-1000}" # - "GID=${GID:-1000}" image: sidp/cope2n-be-fi-sbt - # container_name: "sidp-cope2n-be-celery-manulife-sbt" + # container_name: "sidp-cope2n-be-celery-sbt" environment: - MEDIA_ROOT=${MEDIA_ROOT} - PYTHONPATH=${PYTHONPATH}:/app # For import module @@ -122,7 +121,7 @@ services: - DB_PASSWORD=${DB_PASSWORD} - DB_HOST=${DB_HOST} - DB_PORT=${DB_PUBLIC_PORT} - - BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-manulife-sbt:5672 + - BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672 - BASE_UI_URL=http://fe:${VITE_PORT} - DEBUG=${DEBUG} - IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME} @@ -133,15 +132,15 @@ services: - S3_ACCESS_KEY=${S3_ACCESS_KEY} - S3_SECRET_KEY=${S3_SECRET_KEY} - S3_BUCKET_NAME=${S3_BUCKET_NAME} - - BASE_URL=http://be-ctel-manulife-sbt:${BASE_PORT} + - BASE_URL=http://be-ctel-sbt:${BASE_PORT} networks: - ctel-sbt # restart: always depends_on: - db-manulife-sbt: + db-sbt: condition: service_started - rabbitmq-manulife-sbt: + rabbitmq-sbt: condition: service_started volumes: - ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} @@ -151,10 +150,10 @@ services: working_dir: /app command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO" # Back-end persistent - db-manulife-sbt: + db-sbt: mem_reservation: 500m mem_limit: 1g - # container_name: sidp-cope2n-be-manulife-sbt-db + # container_name: sidp-cope2n-be-sbt-db image: postgres:14.7-alpine volumes: - ./postgres_data:/var/lib/postgresql/data @@ -166,10 +165,10 @@ services: - POSTGRES_PASSWORD=${DB_PASSWORD} - POSTGRES_DB=${DB_SCHEMA} - rabbitmq-manulife-sbt: + rabbitmq-sbt: mem_reservation: 600m mem_limit: 4g - # container_name: sidp-cope2n-be-rabbitmq-manulife-sbt + # container_name: sidp-cope2n-be-rabbitmq-sbt restart: always image: rabbitmq:3.10-alpine # ports: @@ -195,12 +194,12 @@ services: ports: - 9881:80 depends_on: - be-ctel-manulife-sbt: + be-ctel-sbt: condition: service_started - be-celery-manulife-sbt: + be-celery-sbt: condition: service_started environment: - - VITE_PROXY=http://be-ctel-manulife-sbt:${BASE_PORT} + - VITE_PROXY=http://be-ctel-sbt:${BASE_PORT} # - VITE_PROXY=http://42.96.42.13:9880 - VITE_API_BASE_URL=http://fe-sbt:80 volumes: