Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

models.Run: Index the name column #120

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading