Skip to content

Commit

Permalink
Add filestore column (google#662)
Browse files Browse the repository at this point in the history
* add column

* update

* update dispatcher

* update

* update

* update
  • Loading branch information
Shadoom7 authored Aug 11, 2020
1 parent c014024 commit 3095e81
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
29 changes: 29 additions & 0 deletions database/alembic/versions/c83ac04855b4_add_filestore_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Add filestore name
Revision ID: c83ac04855b4
Revises: 77022369cea4
Create Date: 2020-08-11 16:31:36.089779
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'c83ac04855b4'
down_revision = '77022369cea4'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('experiment', sa.Column(
'experiment_filestore', sa.String(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('experiment', 'experiment_filestore')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Experiment(Base):
time_ended = Column(DateTime(), nullable=True)
git_hash = Column(String, nullable=True)
private = Column(Boolean, nullable=False, default=False)
experiment_filestore = Column(String, nullable=True)


class Trial(Base):
Expand Down
10 changes: 6 additions & 4 deletions experiment/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def _initialize_experiment_in_db(experiment_config: dict):
raise Exception('Experiment already exists in database.')

db_utils.add_all([
db_utils.get_or_create(models.Experiment,
name=experiment_config['experiment'],
git_hash=experiment_config['git_hash'],
private=experiment_config.get('private', True))
db_utils.get_or_create(
models.Experiment,
name=experiment_config['experiment'],
git_hash=experiment_config['git_hash'],
private=experiment_config.get('private', True),
experiment_filestore=experiment_config['experiment_filestore'])
])


Expand Down

0 comments on commit 3095e81

Please sign in to comment.