Ejemplo n.º 1
0
def upgrade():
    if is_sqlite():
        with op.batch_alter_table('job_step') as batch_op:
            batch_op.add_column(
                sa.Column('task_name', sa.String(length=200), nullable=True))

        with op.batch_alter_table('job_step_log') as batch_op:
            batch_op.add_column(
                sa.Column('status',
                          sa.Enum('COMPLETED',
                                  'RUNNING',
                                  'INTERRUPTED',
                                  'CANCELED',
                                  'WAITING',
                                  'ERROR',
                                  'PENDING',
                                  name='StatusExecutionEnumType'),
                          nullable=False,
                          server_default='WAITING'))
    else:
        op.add_column(
            'job_step',
            sa.Column('task_name', sa.String(length=200), nullable=True))
        op.add_column(
            'job_step_log',
            sa.Column('status',
                      sa.Enum('COMPLETED',
                              'RUNNING',
                              'INTERRUPTED',
                              'CANCELED',
                              'WAITING',
                              'ERROR',
                              'PENDING',
                              name='StatusExecutionEnumType'),
                      nullable=False))
Ejemplo n.º 2
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('cluster') as batch_op:
            batch_op.drop_column('ui_parameters')
    else:
        op.drop_column('cluster', 'ui_parameters')
Ejemplo n.º 3
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job_step_log') as batch_op:
            batch_op.drop_column('type')
    else:
        op.drop_column('job_step_log', 'type')
Ejemplo n.º 4
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('status_text')
    else:
        op.drop_column('job', 'status_text')
Ejemplo n.º 5
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cluster_platform',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('platform_id', sa.Integer(), nullable=False),
                    sa.Column('cluster_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['cluster_id'],
                        ['cluster.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    if is_mysql():
        op.alter_column('job_step_log',
                        'message',
                        existing_type=mysql.LONGTEXT(),
                        nullable=False)
        op.execute("""
            ALTER TABLE cluster CHANGE `type` `type`
                ENUM('MESOS','YARN','SPARK_LOCAL','KUBERNETES')
                CHARSET utf8 COLLATE utf8_general_ci NOT NULL;
            """)
    elif is_sqlite():
        pass  # No enum support in sqlite
    else:
        op.alter_column('job_step_log',
                        'message',
                        existing_type=sa.Text(),
                        nullable=False)
        values = ['MESOS', 'YARN', 'SPARK_LOCAL', 'KUBERNETES']
        all_commands = [[
            get_psql_enum_alter_commands(['cluster'], ['type'],
                                         'ClusterTypeEnumType', values,
                                         'SPARK_LOCAL'), None
        ]]
Ejemplo n.º 6
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('job_key')
    else:
        # Keeps columns auth_token and general_parameters as nullable
        op.drop_column('job', 'job_key')
Ejemplo n.º 7
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###

    if is_sqlite():
        with op.batch_alter_table('job_result') as batch_op:
            batch_op.drop_column('operation_id')
    else:
        op.drop_column('job_result', 'operation_id')
Ejemplo n.º 8
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('type')
    else:
        op.drop_column('job', 'type')
    if is_psql():
         op.get_bind().execute('DROP TYPE "JobTypeEnumType"')
Ejemplo n.º 9
0
def downgrade():
    if is_sqlite():
        with op.batch_alter_table('job_step_log') as batch_op:
            batch_op.drop_column('status')
        with op.batch_alter_table('job_step') as batch_op:
            batch_op.drop_column('task_name')
    else:
        op.drop_column('job_step_log', 'status')
        op.drop_column('job_step', 'task_name')
Ejemplo n.º 10
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job_result') as batch_op:
            batch_op.drop_column('content')
    else:
        op.drop_column('job_result', 'content')
    op.drop_table('execution_permission')
    if is_psql():
        op.get_bind().execute('DROP TYPE "PermissionTypeEnumType"')
Ejemplo n.º 11
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_mysql():
        op.alter_column('job_step_log',
                        'message',
                        existing_type=mysql.LONGTEXT(),
                        nullable=True)
    elif is_sqlite():
        pass  # Keep cluster options
    else:
        pass  # Keep cluster options
    op.drop_table('cluster_platform')
Ejemplo n.º 12
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job_result') as batch_op:
            batch_op.add_column(
                sa.Column('operation_id',
                          sa.Integer(),
                          nullable=False,
                          server_default='0'))
    else:
        op.add_column('job_result',
                      sa.Column('operation_id', sa.Integer(), nullable=False))
Ejemplo n.º 13
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('cluster') as batch_op:
            batch_op.drop_column('general_parameters')
            batch_op.drop_column('executors')
            batch_op.drop_column('executor_memory')
            batch_op.drop_column('executor_cores')
    else:
        op.drop_column('cluster', 'general_parameters')
        op.drop_column('cluster', 'executors')
        op.drop_column('cluster', 'executor_memory')
        op.drop_column('cluster', 'executor_cores')
Ejemplo n.º 14
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job_step_log') as batch_op:
            batch_op.add_column(
                sa.Column('type',
                          sa.String(length=50),
                          nullable=False,
                          server_default=''))
    else:
        op.add_column('job_step_log',
                      sa.Column('type', sa.String(length=50), nullable=False))

    op.execute("UPDATE job_step_log SET type = 'TEXT'")
Ejemplo n.º 15
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_mysql():
        op.execute("""
            ALTER TABLE job CHANGE `type` `type`
                ENUM('APP','BATCH', 'NORMAL')
                CHARSET utf8 COLLATE utf8_general_ci NOT NULL;
            """)
    elif is_sqlite():
        pass # No enum support in sqlite
    else:
        values = ['APP','BATCH','NORMAL']
        all_commands = [[get_psql_enum_alter_commands(['job'], ['type'],
            'JobTypeEnumType', values, 'NORMAL'), 
            None]]
Ejemplo n.º 16
0
def downgrade():
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('name')
            batch_op.drop_column('exception_stack')
    else:
        op.drop_column('job', 'name')
        op.drop_column('job', 'exception_stack')

    if is_mysql():
        op.execute("""
            ALTER TABLE job
                MODIFY status_text TEXT,
                MODIFY source_code TEXT,
                MODIFY workflow_definition TEXT""")
        op.execute("ALTER TABLE job_result MODIFY content TEXT")
        op.execute("ALTER TABLE job_step_log MODIFY message TEXT")
Ejemplo n.º 17
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    if is_sqlite():
        with op.batch_alter_table('cluster') as batch_op:
            batch_op.alter_column('auth_token', nullable=True)
            batch_op.alter_column('general_parameters', nullable=True)
        with op.batch_alter_table('job') as batch_op:
            batch_op.add_column(
                sa.Column('job_key', sa.String(length=200), nullable=True))
    else:
        op.alter_column('cluster',
                        'auth_token',
                        existing_type=mysql.VARCHAR(
                            collation='utf8_unicode_ci', length=1000),
                        nullable=True)
        op.alter_column('cluster',
                        'general_parameters',
                        existing_type=mysql.VARCHAR(
                            collation='utf8_unicode_ci', length=2000),
                        nullable=True)
        op.add_column(
            'job', sa.Column('job_key', sa.String(length=200), nullable=True))
Ejemplo n.º 18
0
def downgrade():
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('source_code')
    else:
        op.drop_column('job', 'source_code')