Skip to content

Commit

Permalink
complete configured interaction with db
Browse files Browse the repository at this point in the history
  • Loading branch information
cherusk committed Aug 11, 2023
1 parent 15cd7fe commit 319ddfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

from jinja2 import Environment, FileSystemLoader

import archive_db

AIRFLOW_API_BASE_URL = os.environ.get('AIRFLOW__URL')
AIRFLOW_API_VERSION = "v1"
AIRFLOW_API_AUTH_USER = "airflow"
Expand All @@ -47,7 +49,10 @@
DAG_TEMPLATES_DIR = "/usr/src/app/openapi_server/templates/"
DAG_DIR = "/usr/src/app/openapi_server/dags/"

ARCHIVE_DB_BASE_URL= os.environ.get('ARCHIVE_DB_URL')
ARCHIVE_DB_CONFIG = dict(user="yugabyte",
password="yugabyte",
host=os.environ.get('ARCHIVE_DB_HOSTNAME'),
port=os.environ.get('ARCHIVE_DB_PORT'))

breeders_db = dict()

Expand Down Expand Up @@ -171,6 +176,12 @@ def create_breeder(api_client, content):

time.sleep(2) # wait as workaround until synchronous reload of dags implemented

# set dbname to work with to breeder_id
db_config = ARCHIVE_DB_CONFIG.copy()
db_config.update(dict(dbname=breeder_id))

archive_db.__execute(db_info=db_config, statement="")

# Stop calling the API for now until decided
# if we template the breeder dags only or we really want to instrument the API.

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ services:
restart: always
environment:
- AIRFLOW__URL=http://control_loop:8080
- ARCHIVE_DB_URL=http://archive_db:5433
- ARCHIVE_DB_HOSTNAME=archive_db
- ARCHIVE_DB_PORT=5433
volumes:
- ./breeder/linux_network_stack/:/usr/src/app/openapi_server/templates/
- ./breeder/dags:/usr/src/app/openapi_server/dags/
Expand Down

0 comments on commit 319ddfb

Please sign in to comment.