Skip to content

Commit

Permalink
Revert "DM-46747 refactor pqserver per SQR-072"
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrondel authored Jan 27, 2025
1 parent 323ad56 commit 5d73188
Show file tree
Hide file tree
Showing 13 changed files with 1,051 additions and 1,480 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,19 @@ jobs:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Extract Git Tag or Branch
id: git_info
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "GITHUB_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "GITHUB_TAG=noversion" >> $GITHUB_ENV
fi
- name: Build hinfo
uses: lsst-sqre/build-and-push-to-ghcr@v1
with:
image: ${{ github.repository }}-hinfo
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile.hinfo

- name: Build hinfo
uses: lsst-sqre/build-and-push-to-ghcr@v1
with:
image: ${{ github.repository }}-hinfo
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile.hinfo

- name: Build pqserver
uses: lsst-sqre/build-and-push-to-ghcr@v1
with:
image: ${{ github.repository }}-pq
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile.pqserver
build-args: |
GITHUB_TAG=${{ env.GITHUB_TAG }}
- name: Build pqserver
uses: lsst-sqre/build-and-push-to-ghcr@v1
with:
image: ${{ github.repository }}-pq
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile.pqserver
20 changes: 1 addition & 19 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,5 @@ jobs:
- name: Build docker image
run: docker build -f Dockerfile.pytest -t pytest_image .

- name: Create directory for coverage report
run: mkdir -p ${{ github.workspace }}/pytest_reports

- name: Set coverage report directory permissions
run: chmod -R 777 ${{ github.workspace }}/pytest_reports

- name: Run docker image
run: docker run --rm -v ${{ github.workspace }}/pytest_reports:/home/lsst/consdb/pytest_reports -e PYTEST_ADDOPTS="--color=yes" pytest_image

- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: pytest_report
path: pytest_reports/pytest_report.html

- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage_report
path: pytest_reports/htmlcov
run: docker run --rm -e PYTEST_ADDOPTS="--color=yes" pytest_image
19 changes: 1 addition & 18 deletions Dockerfile.pqserver
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
FROM python:3.11

ARG GITHUB_TAG
ENV VERSION=${GITHUB_TAG}

RUN pip install fastapi safir astropy uvicorn gunicorn sqlalchemy psycopg2
WORKDIR /
COPY \
python/lsst/consdb/__init__.py \
python/lsst/consdb/pqserver.py \
python/lsst/consdb/cdb_schema.py \
python/lsst/consdb/config.py \
python/lsst/consdb/dependencies.py \
python/lsst/consdb/exceptions.py \
python/lsst/consdb/models.py \
/consdb_pq/
COPY \
python/lsst/consdb/handlers/external.py \
python/lsst/consdb/handlers/internal.py \
/consdb_pq/handlers/

COPY python/lsst/consdb/__init__.py python/lsst/consdb/pqserver.py python/lsst/consdb/utils.py /consdb_pq/
# Environment variables that must be set:
# DB_HOST DB_PASS DB_USER DB_NAME or POSTGRES_URL

Expand Down
8 changes: 2 additions & 6 deletions Dockerfile.pytest
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ RUN yum install -y postgresql-server postgresql && rmdir /usr/local/bin && ln -s

USER lsst
RUN source loadLSST.bash && mamba install -y aiokafka httpx
RUN source loadLSST.bash && pip install kafkit aiokafka httpx pytest-asyncio pytest-cov pytest-html testing.postgresql lsst-felis safir
RUN source loadLSST.bash && pip install kafkit aiokafka httpx pytest-asyncio testing.postgresql lsst-felis

WORKDIR /home/lsst/

COPY --chown=lsst . ./consdb/
WORKDIR /home/lsst/consdb/
RUN source /opt/lsst/software/stack/loadLSST.bash && pip install -e .

USER root
RUN mkdir -p /home/lsst/consdb/pytest_reports && chown lsst:lsst /home/lsst/consdb/pytest_reports
USER lsst

ENTRYPOINT [ "/bin/bash", "-c", "source /opt/lsst/software/stack/loadLSST.bash; setup obs_lsst; setup felis; pytest --cov=./ --cov-report=html:/home/lsst/consdb/pytest_reports/htmlcov --html=pytest_reports/pytest_report.html --self-contained-html ." ]
ENTRYPOINT [ "/bin/bash", "-c", "source /opt/lsst/software/stack/loadLSST.bash; setup obs_lsst; setup felis; pytest ." ]
Loading

0 comments on commit 5d73188

Please sign in to comment.