Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Add pgadmin and internal_access containers as components #6

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components/internal_access/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM python:latest
COPY ../../cvat_scripts/cvat_tasks/requirements.txt /tmp/requirements.txt
RUN pip install psycopg2-binary -r /tmp/requirements.txt
19 changes: 19 additions & 0 deletions components/internal_access/docker-compose.entry_point.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
internal_access:
container_name: internal_access
build: ./components/internal_access
restart: always
networks:
- cvat
logging:
driver: "json-file"
options:
max-size: 100m
max-file: "3"
volumes:
- ../../cvat_scripts/cvat_tasks:/home/cvat_tasks
environment:
- CVAT_INTERNALS=1
stdin_open: true
tty: true

3 changes: 3 additions & 0 deletions components/pg_admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM dpage/pgadmin4
COPY ./server_config.json /tmp
RUN source /venv/bin/activate && python3 /pgadmin4/setup.py --load-servers /tmp/server_config.json --user [email protected]
24 changes: 24 additions & 0 deletions components/pg_admin/docker-compose.pg_admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:
pgadmin:
container_name: pg_admin
build: ./components/pg_admin
restart: always
depends_on:
- cvat_db
networks:
- cvat
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
ports:
- "8888:80"
logging:
driver: "json-file"
options:
max-size: 100m
max-file: "3"
volumes:
- pgadmin-data:/var/lib/pgadmin
volumes:
pgadmin-data:

22 changes: 22 additions & 0 deletions components/pg_admin/server_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Servers": {
"1": {
"Name": "cvat",
"Group": "Servers",
"Host": "cvat_db",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "root",
"UseSSHTunnel": 0,
"TunnelPort": "22",
"TunnelAuthentication": 0,
"KerberosAuthentication": false,
"ConnectionParameters": {
"sslmode": "prefer",
"connect_timeout": 10,
"sslcert": "<STORAGE_DIR>/.postgresql/postgresql.crt",
"sslkey": "<STORAGE_DIR>/.postgresql/postgresql.key"
}
}
}
}
11 changes: 9 additions & 2 deletions cvat/apps/lambda_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import cvat.apps.dataset_manager as dm
from cvat.apps.engine.frame_provider import FrameProvider
from cvat.apps.engine.models import Job, ShapeType, SourceType, Task
from cvat.apps.engine.models import Job, ShapeType, SourceType, Task, DataChoice
from cvat.apps.engine.serializers import LabeledDataSerializer
from cvat.apps.lambda_manager.serializers import (
FunctionCallRequestSerializer, FunctionCallSerializer
Expand Down Expand Up @@ -285,8 +285,15 @@ def invoke(


if self.kind == LambdaType.DETECTOR:
if db_task.data.original_chunk_type == DataChoice.VIDEO:
data_path = db_task.data.video.path
elif db_task.data.original_chunk_type == DataChoice.IMAGESET:
data_path = db_task.data.images.get(frame=data["frame"]).path
else:
data_path = ""
payload.update({
"image": self._get_image(db_task, data["frame"], quality)
"image": self._get_image(db_task, data["frame"], quality),
"data_path": data_path
})
elif self.kind == LambdaType.INTERACTOR:
payload.update({
Expand Down