Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/task_scheduler' into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
Sander committed May 19, 2017
1 parent f1b27ab commit 773479f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
75 changes: 75 additions & 0 deletions gengine/app/alembic/versions/a90076b18837_tasks_and_shift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""tasks and shift
Revision ID: a90076b18837
Revises: 8e65de1ed535
Create Date: 2017-05-19 11:18:09.260416
"""

# revision identifiers, used by Alembic.
revision = 'a90076b18837'
down_revision = '8e65de1ed535'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('tasks',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('entry_name', sa.String(length=100), nullable=True),
sa.Column('task_name', sa.String(length=100), nullable=False),
sa.Column('config', sa.JSON(), nullable=True),
sa.Column('cron', sa.String(length=100), nullable=True),
sa.Column('is_removed', sa.Boolean(), nullable=False),
sa.Column('is_auto_created', sa.Boolean(), nullable=False),
sa.Column('is_user_modified', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_tasks'))
)
op.create_index(op.f('ix_tasks_entry_name'), 'tasks', ['entry_name'], unique=False)
op.create_index(op.f('ix_tasks_is_auto_created'), 'tasks', ['is_auto_created'], unique=False)
op.create_index(op.f('ix_tasks_is_removed'), 'tasks', ['is_removed'], unique=False)
op.create_index(op.f('ix_tasks_is_user_modified'), 'tasks', ['is_user_modified'], unique=False)
op.create_index(op.f('ix_tasks_task_name'), 'tasks', ['task_name'], unique=False)
op.create_table('taskexecutions',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('task_id', sa.Integer(), nullable=False),
sa.Column('planned_at', postgresql.TIMESTAMP(timezone=True), nullable=False),
sa.Column('locked_at', postgresql.TIMESTAMP(timezone=True), nullable=True),
sa.Column('finished_at', postgresql.TIMESTAMP(timezone=True), nullable=True),
sa.Column('canceled_at', postgresql.TIMESTAMP(timezone=True), nullable=True),
sa.Column('log', sa.String(), nullable=True),
sa.Column('success', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['task_id'], ['tasks.id'], name=op.f('fk_taskexecutions_task_id_tasks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id', name=op.f('pk_taskexecutions'))
)
op.create_index(op.f('ix_taskexecutions_canceled_at'), 'taskexecutions', ['canceled_at'], unique=False)
op.create_index(op.f('ix_taskexecutions_finished_at'), 'taskexecutions', ['finished_at'], unique=False)
op.create_index(op.f('ix_taskexecutions_locked_at'), 'taskexecutions', ['locked_at'], unique=False)
op.create_index(op.f('ix_taskexecutions_planned_at'), 'taskexecutions', ['planned_at'], unique=False)
op.create_index(op.f('ix_taskexecutions_success'), 'taskexecutions', ['success'], unique=False)
op.create_index(op.f('ix_taskexecutions_task_id'), 'taskexecutions', ['task_id'], unique=False)
op.add_column('achievements', sa.Column('evaluation_shift', sa.Integer(), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('achievements', 'evaluation_shift')
op.drop_index(op.f('ix_taskexecutions_task_id'), table_name='taskexecutions')
op.drop_index(op.f('ix_taskexecutions_success'), table_name='taskexecutions')
op.drop_index(op.f('ix_taskexecutions_planned_at'), table_name='taskexecutions')
op.drop_index(op.f('ix_taskexecutions_locked_at'), table_name='taskexecutions')
op.drop_index(op.f('ix_taskexecutions_finished_at'), table_name='taskexecutions')
op.drop_index(op.f('ix_taskexecutions_canceled_at'), table_name='taskexecutions')
op.drop_table('taskexecutions')
op.drop_index(op.f('ix_tasks_task_name'), table_name='tasks')
op.drop_index(op.f('ix_tasks_is_user_modified'), table_name='tasks')
op.drop_index(op.f('ix_tasks_is_removed'), table_name='tasks')
op.drop_index(op.f('ix_tasks_is_auto_created'), table_name='tasks')
op.drop_index(op.f('ix_tasks_entry_name'), table_name='tasks')
op.drop_table('tasks')
### end Alembic commands ###
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ alembic==0.9.1
appdirs==1.4.3
Chameleon==3.1
click==6.7
croniter==0.3.16
dogpile.cache==0.6.2
Flask==0.12
Flask-Admin==1.5.0
Expand All @@ -26,6 +27,7 @@ pyramid-debugtoolbar==3.0.5
pyramid-dogpile-cache==0.0.4
pyramid-mako==1.0.2
pyramid-tm==1.1.1
python-crontab==2.2.2
python-editor==1.0.3
pytz==2016.10
raven==6.0.0
Expand Down

0 comments on commit 773479f

Please sign in to comment.