Skip to content

Commit

Permalink
Editing makefile to add hub/edge separation when build // Adding labe…
Browse files Browse the repository at this point in the history
…lboxAPI key to post api method
  • Loading branch information
ThibautLeibel committed Apr 19, 2024
1 parent 6b23967 commit ec0a927
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,22 @@ hub_labelizer:
hub_monitoring_db:
docker-compose up -d --build hub_monitoring_db

.PHONY: vio-edge-up ## 🐳 Start all services (db, model_serving, orchestrator, interface) and local hub monitoring
.PHONY: vio-hub-up ## 🐳 Start all hub services (monitoring, monitoring_db, labelizer)
vio-hub-up:
docker-compose --profile hub up -d --build

.PHONY: vio-edge-up ## 🐳 Start all edge services (db, model_serving, orchestrator, interface)
vio-edge-up:
docker-compose --profile edge up -d --build

.PHONY: vio-up ## 🐳 Start all edge services (db, model_serving, orchestrator, interface) and hubs (monitoring, monitoring_db, labelizer)
vio-up:
docker-compose up -d --build

.PHONY: vio-edge-up-raspberrypi ## 🐳 Start all edge services on RaspberryPI (db, model_serving, orchestrator, interface)
vio-edge-up-raspberrypi:
docker-compose -f docker-compose.raspberrypi.yml up -d --build

.PHONY: vio-edge-down ## ❌ Stop all services (model_serving, edge_orchestrator, ui)
vio-edge-down:
.PHONY: vio-down ## ❌ Stop all services (model_serving, edge_orchestrator, ui)
vio-down:
docker-compose down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
container_name: edge_db
ports:
- 27017:27017
profiles: [edge]

edge_model_serving:
container_name: edge_model_serving
Expand All @@ -16,6 +17,7 @@ services:
- TF_CPP_MIN_VLOG_LEVEL=0
ports:
- 8501:8501
profiles: [edge]
# volumes:
# - ./edge_model_serving/models:/models

Expand All @@ -35,6 +37,7 @@ services:
SERVING_MODEL_URL: http://edge_model_serving:8501
MONGO_DB_URI: mongodb://edge_db:27017/
POSTGRES_DB_URI: postgresql://vio:vio@hub_monitoring_db:5432/vio
profiles: [edge]

hub_labelizer:
container_name: hub_labelizer
Expand All @@ -48,6 +51,7 @@ services:
environment:
API_CONFIG: docker
EDGE_ORCHESTRATOR_URL: http://edge_orchestrator:8000
profiles: [hub]

edge_interface:
container_name: edge_interface
Expand All @@ -56,6 +60,7 @@ services:
dockerfile: Dockerfile
ports:
- 8080:80
profiles: [edge]

hub_monitoring:
container_name: hub_monitoring
Expand All @@ -67,6 +72,7 @@ services:
volumes:
- ./hub_monitoring/grafana/dashboards:/var/lib/grafana/dashboards
- ./hub_monitoring/grafana/provisioning:/etc/grafana/provisioning
profiles: [hub]

hub_monitoring_db:
container_name: hub_monitoring_db
Expand All @@ -81,6 +87,7 @@ services:
volumes:
- vio-postgresql-data:/var/lib/postgresql/data
- ./hub_monitoring/docker/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
profiles: [hub]

volumes:
vio-postgresql-data:
3 changes: 2 additions & 1 deletion hub_labelizer/hub_labelizer/application/trigger_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ async def drop_to_labelizer_job(
project_id: str = None,
dataset_id: str = None,
config_name: str = None,
api_key: str = None,
labelizer: Labelizer = Depends(get_labelizer),
background_tasks: BackgroundTasks = None,
):
filters = {}
background_tasks.add_task(
labelizer.apost_images, project_id, dataset_id, config_name, filters
labelizer.apost_images, project_id, dataset_id, config_name, api_key, filters
)
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ def load_dataset(self, dataset_id: str):
self.dataset = self.client.get_dataset(dataset_id)

async def apost_images(
self, project_id: str, dataset_id: str, config_name: str, filters: dict
self, project_id: str, dataset_id: str, config_name: str, api_key: str, filters: dict
):
if not api_key:
self.client = lb.Client(api_key=os.getenv("LABELBOX_API_KEY"))

self.load_dataset(dataset_id)
url_orchestrator = os.getenv("EDGE_ORCHESTRATOR_URL")
print(url_orchestrator)
binaries_annotations = await aget_binaries_annotations_path(
url_orchestrator, config_name
)
Expand Down

0 comments on commit ec0a927

Please sign in to comment.