Commit f5125041 authored by Andrea Giannetti's avatar Andrea Giannetti
Browse files

Adapted scripts for docker compose.

parent 42393340
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+28 −0
Original line number Diff line number Diff line
FROM python:3.9-slim


# STEP 1) Setting up environment
# apt packages
RUN apt-get update && \
    apt-get --yes upgrade && \
    apt-get install --yes libgomp1 && \
    apt-get install --yes postgresql-client && \
    apt-get install --yes --reinstall build-essential && \
    apt-get -y install curl vim less nano pip git && \
    apt-get -y install zip unzip

WORKDIR /usr/src/etl
RUN python -m pip install --upgrade pip
COPY etl/requirements.txt .
RUN pip install -r requirements.txt

COPY documentation/radmc3d_install.sh .
RUN chmod 755 radmc3d_install.sh
RUN ./radmc3d_install.sh
ENV PATH="/root/bin:${PATH}"
ENV PYTHONPATH="/root/bin/python:${PYTHONPATH}"

# STEP 2) Bundling app
COPY etl .

CMD python main.py
 No newline at end of file
+38 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ version: '3.8'
services:
  db:
    image: postgres:14.1-alpine
    container_name: db_container
    restart: always
    environment:
      - POSTGRES_DB=$DB_NAME
@@ -11,6 +12,27 @@ services:
      - '5432:5432'
    volumes:
      - db:/var/lib/postgresql/data
    networks:
      - sak_network
    network_mode: 'bridge'

  etl:
    build:
      dockerfile: Dockerfile
    container_name: 'etl'
    image: 'sak_etl'
    depends_on:
      - db
    stdin_open: true
    tty: true
    networks:
      - sak_network
    network_mode: 'bridge'
    volumes:
      - ./etl:/usr/src/etl
volumes:
  db:
    driver: local
networks:
  sak_network:
    name: 'sak_app_network'
 No newline at end of file
+5 −5
Original line number Diff line number Diff line
#!/bin/bash
# Set PYCHARM_HOME, INSTALL_DEPENDENCIES environment variable
PYCHARM_HOME=${PYCHARM_HOME:=$HOME/PycharmProjects}
INSTALL_DEPENDENCIES="${INSTALL_DEPENDENCIES:=false}"
PYCHARM_HOME=${PYCHARM_HOME:=$HOME}
INSTALL_DEPENDENCIES="${INSTALL_DEPENDENCIES:=true}"
echo $PYCHARM_HOME
cd $PYCHARM_HOME
export RADMC_HOME=$PYCHARM_HOME/radmc3d-2.0
@@ -13,14 +13,14 @@ fi

if $INSTALL_DEPENDENCIES
then
    sudo apt-get install gfortran
    apt-get install -y gfortran
fi

cd $RADMC_HOME/src
make
make install
echo "y\n y\n"| make install

# Add this to thee .bashrc configuration file (or equivalent)
# Add this to the .bashrc configuration file (or equivalent)
export PATH=$HOME/bin:$PATH
export PYTHONPATH=$HOME/bin/python:$PYTHONPATH

+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ from prs.prs_inspect_results import main as prs_inspection_main

def build_model_grid():
    stg_config = load_config_file(os.path.join('stg', 'config', 'config.yml'))
    pl_density_index = float(stg_config['density_powerlaw_idx'])
    pl_density_index = float(stg_config['grid']['density_powerlaw_idx'])
    _model_type = 'spherical' if pl_density_index != 0 else 'homogeneous'

    config = load_config_file(os.path.join('config', 'config.yml'))
@@ -24,7 +24,7 @@ def build_model_grid():

    grid_tarfiles = []

    density_keyword = 'central_density' if _model_type == 'homogeneous' else 'density_value_at_reference'
    density_keyword = 'central_density' if _model_type == 'homogeneous' else 'density_at_reference'

    for (tdust, nh2) in product(dust_temperatures, densities):
        overrides = {
+3 −1
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ def get_aggregated_ratio_from_db(
                                                                                           or_(RatioMaps.mom_zero_map_1,
                                                                                               RatioMaps.mom_zero_map_2)).filter(
        and_(GridPars.dust_temperature == dust_temperature,
             GridPars.central_density == gas_density, or_(ModelPars.iline.in_(lines)))).all()
             GridPars.density_at_reference == gas_density,
             # GridPars.central_density == gas_density,
             or_(ModelPars.iline.in_(lines)))).all()
    assert len(results) == 1
    return results[0][1].aggregated_ratio

Loading