Skip to content

Commit

Permalink
Merge pull request #120 from ceph/runs-index
Browse files Browse the repository at this point in the history
  • Loading branch information
zmc authored Sep 1, 2023
2 parents 0365ed8 + d2449bc commit 3f4327e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
16 changes: 5 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
FROM python:3.11-alpine
EXPOSE 8080
RUN microdnf update -y && \
microdnf install -y \
curl \
lsof \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
tzdata
ENV TZ="UTC"
RUN apk add curl tzdata && \
pip install -U pip

# Install dependencies:
COPY requirements.txt .
Expand All @@ -21,4 +15,4 @@ COPY config.py.in /paddles/config.py
COPY alembic.ini.in /paddles/alembic.ini
COPY container_start.sh /paddles/container_start.sh
WORKDIR /paddles
CMD bash container_start.sh
CMD sh container_start.sh
21 changes: 21 additions & 0 deletions alembic/versions/266e6f3efd94_index_run_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Index Run.name
Revision ID: 266e6f3efd94
Revises: 11e2594da07b
Create Date: 2023-07-31 12:01:24.936988
"""

# revision identifiers, used by Alembic.
revision = '266e6f3efd94'
down_revision = '11e2594da07b'

from alembic import op


def upgrade():
op.create_index('ix_runs_name', 'runs', ['name'], unique=True)


def downgrade():
op.drop_index('ix_runs_name', table_name='runs')
2 changes: 1 addition & 1 deletion container_start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -ex
trap exit TERM
pecan populate config.py
Expand Down
2 changes: 1 addition & 1 deletion paddles/models/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Run(Base):

__tablename__ = 'runs'
id = Column(Integer, primary_key=True)
name = Column(String(512), unique=True)
name = Column(String(512), index=True, unique=True)
status = Column(String(16), index=True)
user = Column(String(32), index=True)
scheduled = Column(DateTime, index=True)
Expand Down

0 comments on commit 3f4327e

Please sign in to comment.