mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
This commit is contained in:
commit
bafa522eae
@ -252,7 +252,7 @@ class AnonymousUser(AnonymousUserMixin):
|
||||
|
||||
class JobInput(db.Model):
|
||||
"""
|
||||
Class to define Files.
|
||||
Class to define JobInputs.
|
||||
"""
|
||||
__tablename__ = 'job_inputs'
|
||||
# Primary key
|
||||
@ -265,10 +265,21 @@ class JobInput(db.Model):
|
||||
lazy='dynamic',
|
||||
cascade='save-update, merge, delete')
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
String representation of the JobInput. For human readability.
|
||||
"""
|
||||
return '<JobInput %r>' % self.filename
|
||||
|
||||
def to_dict(self):
|
||||
return {'id': self.id,
|
||||
'filename': self.filename,
|
||||
'job_id': self.job_id}
|
||||
|
||||
|
||||
class JobResult(db.Model):
|
||||
"""
|
||||
Class to define Files.
|
||||
Class to define JobResults.
|
||||
"""
|
||||
__tablename__ = 'job_results'
|
||||
# Primary key
|
||||
@ -277,6 +288,17 @@ class JobResult(db.Model):
|
||||
job_id = db.Column(db.Integer, db.ForeignKey('jobs.id'))
|
||||
job_input_id = db.Column(db.Integer, db.ForeignKey('job_inputs.id'))
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
String representation of the JobResult. For human readability.
|
||||
"""
|
||||
return '<JobResult %r>' % self.filename
|
||||
|
||||
def to_dict(self):
|
||||
return {'id': self.id,
|
||||
'filename': self.filename,
|
||||
'job_id': self.job_id}
|
||||
|
||||
|
||||
class Job(db.Model):
|
||||
"""
|
||||
@ -325,8 +347,10 @@ class Job(db.Model):
|
||||
'description': self.description,
|
||||
'end_date': (self.end_date.timestamp() if self.end_date else
|
||||
None),
|
||||
'inputs': [input.to_dict() for input in self.inputs],
|
||||
'mem_mb': self.mem_mb,
|
||||
'n_cores': self.n_cores,
|
||||
'results': [result.to_dict() for result in self.results],
|
||||
'service': self.service,
|
||||
'service_args': self.service_args,
|
||||
'service_version': self.service_version,
|
||||
|
@ -19,6 +19,7 @@ services:
|
||||
- storage:/mnt/opaque
|
||||
- ./app:/home/opaque/app
|
||||
- ./config.py:/home/opaque/config.py
|
||||
- ./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
|
||||
- ./logs:/home/opaque/logs
|
||||
- ./migrations:/home/opaque/migrations
|
||||
- ./opaque.py:/home/opaque/opaque.py
|
||||
|
105
migrations/versions/91ef50fe9f01_.py
Normal file
105
migrations/versions/91ef50fe9f01_.py
Normal file
@ -0,0 +1,105 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 91ef50fe9f01
|
||||
Revises:
|
||||
Create Date: 2019-10-17 09:37:36.995203
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '91ef50fe9f01'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('roles',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('default', sa.Boolean(), nullable=True),
|
||||
sa.Column('name', sa.String(length=64), nullable=True),
|
||||
sa.Column('permissions', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
|
||||
op.create_table('users',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('confirmed', sa.Boolean(), nullable=True),
|
||||
sa.Column('email', sa.String(length=254), nullable=True),
|
||||
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
||||
sa.Column('registration_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('role_id', sa.Integer(), nullable=True),
|
||||
sa.Column('username', sa.String(length=64), nullable=True),
|
||||
sa.Column('is_dark', sa.Boolean(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
|
||||
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
|
||||
op.create_table('corpora',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('description', sa.String(length=255), nullable=True),
|
||||
sa.Column('title', sa.String(length=32), nullable=True),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('jobs',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('description', sa.String(length=255), nullable=True),
|
||||
sa.Column('end_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('mem_mb', sa.Integer(), nullable=True),
|
||||
sa.Column('n_cores', sa.Integer(), nullable=True),
|
||||
sa.Column('service', sa.String(length=64), nullable=True),
|
||||
sa.Column('service_args', sa.String(length=255), nullable=True),
|
||||
sa.Column('service_version', sa.String(length=16), nullable=True),
|
||||
sa.Column('status', sa.String(length=16), nullable=True),
|
||||
sa.Column('title', sa.String(length=32), nullable=True),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('corpus_files',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||
sa.Column('corpus_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['corpus_id'], ['corpora.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('job_inputs',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||
sa.Column('job_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('job_results',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||
sa.Column('job_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('job_results')
|
||||
op.drop_table('job_inputs')
|
||||
op.drop_table('corpus_files')
|
||||
op.drop_table('jobs')
|
||||
op.drop_table('corpora')
|
||||
op.drop_index(op.f('ix_users_username'), table_name='users')
|
||||
op.drop_index(op.f('ix_users_email'), table_name='users')
|
||||
op.drop_table('users')
|
||||
op.drop_index(op.f('ix_roles_default'), table_name='roles')
|
||||
op.drop_table('roles')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user