spiff-arena/spiffworkflow-backend/migrations/versions/441dca328887_.py

63 lines
2.8 KiB
Python
Raw Normal View History

Feature/background proc with celery (#788) * WIP: some initial test code to test out celery w/ burnettk * some cleanup for celery and added base model to put tasks waiting on timers * removed dup bpmn file * some more cleanup and added strategy to queue instructions * some minor code changes w/ burnettk * remove the unused next_task key from api calls since nobody uses it w/ burnettk essweine * added migration for future tasks and added test to make sure we are inserting into it w/ burnettk essweine * ensure future task run at time can be updated w/ burnettk * added table to queue instructions for end user in w/ burnettk * added test to ensure we are storing instructions for end users w/ burnettk * added progress page to display new instructions to user * ignore dup instructions on db insert w/ burnettk * some more updates for celery w/ burnettk * some pyl and test fixes w/ burnettk * fixed tests w/ burnettk * WIP: added in page to show instructions on pi show page w/ burnettk * pi show page is fully using not interstitial now w/ burnettk * fixed broken test w/ burnettk * moved background processing items to own module w/ burnettk * fixed apscheduler start script * updated celery task queue to handle future tasks and upgraded black and set its line-length to match ruff w/ burnettk * added support to run future tasks using countdown w/ burnettk * build image for celery branch w/ burnettk * poet does not exist in the image w/ burnettk * start blocking scheduler should always start the scheduler w/ burnettk * add init and stuff for this branch * make this work not just on my mac * send other args to only * added running status for process instance and use that on fe to go to show page and added additional identifier to locking system to isolate celery workers better w/ burnettk * fixed typing error that typeguard found, not sure why mypy did not w/ burnettk * do not check for no instructions on interstitial page for cypress tests on frontend w/ burnettk * do not queue process instances twice w/ burnettk * removed bad file w/ burnettk * queue tasks using strings to avoid circular imports when attmepting to queue w/ burnettk * only queue imminent new timer events and mock celery * some keyboard shortcut support on frontend and added ability to force run a process instance over the api w/ burnettk * some styles added for the shortcut menu w/ burnettk * pyl w/ burnettk * fixed test w/ burnettk * removed temporary celery script and added support for celery worker in run server locally w/ burnettk * cleaned up migrations w/ burnettk * created new migration to clean up old migrations --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com> Co-authored-by: burnettk <burnettk@users.noreply.github.com>
2023-12-05 16:41:59 +00:00
"""empty message
Revision ID: 441dca328887
Revises: 1b5a9f7af28e
Create Date: 2023-12-05 10:36:32.487659
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '441dca328887'
down_revision = '1b5a9f7af28e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('future_task',
sa.Column('guid', sa.String(length=36), nullable=False),
sa.Column('run_at_in_seconds', sa.Integer(), nullable=False),
sa.Column('completed', sa.Boolean(), nullable=False),
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('guid')
)
with op.batch_alter_table('future_task', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_future_task_completed'), ['completed'], unique=False)
batch_op.create_index(batch_op.f('ix_future_task_run_at_in_seconds'), ['run_at_in_seconds'], unique=False)
op.create_table('task_instructions_for_end_user',
sa.Column('task_guid', sa.String(length=36), nullable=False),
sa.Column('instruction', sa.Text(), nullable=False),
sa.Column('process_instance_id', sa.Integer(), nullable=False),
sa.Column('has_been_retrieved', sa.Boolean(), nullable=False),
sa.Column('timestamp', sa.DECIMAL(precision=17, scale=6), nullable=False),
sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ),
sa.PrimaryKeyConstraint('task_guid')
)
with op.batch_alter_table('task_instructions_for_end_user', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_task_instructions_for_end_user_has_been_retrieved'), ['has_been_retrieved'], unique=False)
batch_op.create_index(batch_op.f('ix_task_instructions_for_end_user_process_instance_id'), ['process_instance_id'], unique=False)
batch_op.create_index(batch_op.f('ix_task_instructions_for_end_user_timestamp'), ['timestamp'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('task_instructions_for_end_user', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_task_instructions_for_end_user_timestamp'))
batch_op.drop_index(batch_op.f('ix_task_instructions_for_end_user_process_instance_id'))
batch_op.drop_index(batch_op.f('ix_task_instructions_for_end_user_has_been_retrieved'))
op.drop_table('task_instructions_for_end_user')
with op.batch_alter_table('future_task', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_future_task_run_at_in_seconds'))
batch_op.drop_index(batch_op.f('ix_future_task_completed'))
op.drop_table('future_task')
# ### end Alembic commands ###