Exemplo n.º 1
0
class JobBinaryInternal(mb.SaharaBase):
    """JobBinaryInternal - raw binary storage for executable jobs."""

    __tablename__ = 'job_binary_internal'

    __table_args__ = (sa.UniqueConstraint('name', 'tenant_id'), )

    id = _id_column()
    tenant_id = sa.Column(sa.String(36))
    name = sa.Column(sa.String(80), nullable=False)
    data = sa.orm.deferred(sa.Column(st.LargeBinary()))
    datasize = sa.Column(sa.BIGINT)
Exemplo n.º 2
0
def upgrade():
    op.create_table('jobs',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('type', sa.String(length=80), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('node_group_templates',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('flavor_id',
                              sa.String(length=36),
                              nullable=False),
                    sa.Column('image_id', sa.String(length=36), nullable=True),
                    sa.Column('plugin_name',
                              sa.String(length=80),
                              nullable=False),
                    sa.Column('hadoop_version',
                              sa.String(length=80),
                              nullable=False),
                    sa.Column('node_processes',
                              st.JsonEncoded(),
                              nullable=True),
                    sa.Column('node_configs', st.JsonEncoded(), nullable=True),
                    sa.Column('volumes_per_node', sa.Integer(),
                              nullable=False),
                    sa.Column('volumes_size', sa.Integer(), nullable=True),
                    sa.Column('volume_mount_prefix',
                              sa.String(length=80),
                              nullable=True),
                    sa.Column('floating_ip_pool',
                              sa.String(length=36),
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('cluster_templates',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('cluster_configs',
                              st.JsonEncoded(),
                              nullable=True),
                    sa.Column('default_image_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('anti_affinity', st.JsonEncoded(),
                              nullable=True),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('neutron_management_network',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('plugin_name',
                              sa.String(length=80),
                              nullable=False),
                    sa.Column('hadoop_version',
                              sa.String(length=80),
                              nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('job_binary_internal',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('data', st.LargeBinary(), nullable=True),
                    sa.Column('datasize', sa.BIGINT(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('job_binaries',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('url', sa.String(length=256), nullable=False),
                    sa.Column('extra', st.JsonEncoded(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('data_sources',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('type', sa.String(length=80), nullable=False),
                    sa.Column('url', sa.String(length=256), nullable=False),
                    sa.Column('credentials', st.JsonEncoded(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('libs_association',
                    sa.Column('Job_id', sa.String(length=36), nullable=True),
                    sa.Column('JobBinary_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['JobBinary_id'],
                        ['job_binaries.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['Job_id'],
                        ['jobs.id'],
                    ),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('clusters',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('trust_id', sa.String(length=36), nullable=True),
                    sa.Column('is_transient', sa.Boolean(), nullable=True),
                    sa.Column('plugin_name',
                              sa.String(length=80),
                              nullable=False),
                    sa.Column('hadoop_version',
                              sa.String(length=80),
                              nullable=False),
                    sa.Column('cluster_configs',
                              st.JsonEncoded(),
                              nullable=True),
                    sa.Column('default_image_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('neutron_management_network',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('anti_affinity', st.JsonEncoded(),
                              nullable=True),
                    sa.Column('management_private_key',
                              sa.Text(),
                              nullable=False),
                    sa.Column('management_public_key',
                              sa.Text(),
                              nullable=False),
                    sa.Column('user_keypair_id',
                              sa.String(length=80),
                              nullable=True),
                    sa.Column('status', sa.String(length=80), nullable=True),
                    sa.Column('status_description',
                              sa.String(length=200),
                              nullable=True),
                    sa.Column('info', st.JsonEncoded(), nullable=True),
                    sa.Column('extra', st.JsonEncoded(), nullable=True),
                    sa.Column('cluster_template_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['cluster_template_id'],
                        ['cluster_templates.id'],
                    ),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'tenant_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('templates_relations',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('flavor_id',
                              sa.String(length=36),
                              nullable=False),
                    sa.Column('image_id', sa.String(length=36), nullable=True),
                    sa.Column('node_processes',
                              st.JsonEncoded(),
                              nullable=True),
                    sa.Column('node_configs', st.JsonEncoded(), nullable=True),
                    sa.Column('volumes_per_node', sa.Integer(), nullable=True),
                    sa.Column('volumes_size', sa.Integer(), nullable=True),
                    sa.Column('volume_mount_prefix',
                              sa.String(length=80),
                              nullable=True),
                    sa.Column('count', sa.Integer(), nullable=False),
                    sa.Column('cluster_template_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('node_group_template_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('floating_ip_pool',
                              sa.String(length=36),
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['cluster_template_id'],
                        ['cluster_templates.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['node_group_template_id'],
                        ['node_group_templates.id'],
                    ),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('mains_association',
                    sa.Column('Job_id', sa.String(length=36), nullable=True),
                    sa.Column('JobBinary_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['JobBinary_id'],
                        ['job_binaries.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['Job_id'],
                        ['jobs.id'],
                    ),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('job_executions',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('job_id', sa.String(length=36), nullable=True),
                    sa.Column('input_id', sa.String(length=36), nullable=True),
                    sa.Column('output_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('start_time', sa.DateTime(), nullable=True),
                    sa.Column('end_time', sa.DateTime(), nullable=True),
                    sa.Column('cluster_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('info', st.JsonEncoded(), nullable=True),
                    sa.Column('progress', sa.Float(), nullable=True),
                    sa.Column('oozie_job_id',
                              sa.String(length=100),
                              nullable=True),
                    sa.Column('return_code',
                              sa.String(length=80),
                              nullable=True),
                    sa.Column('job_configs', st.JsonEncoded(), nullable=True),
                    sa.Column('extra', st.JsonEncoded(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['cluster_id'],
                        ['clusters.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['input_id'],
                        ['data_sources.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['job_id'],
                        ['jobs.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['output_id'],
                        ['data_sources.id'],
                    ),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('node_groups',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('flavor_id',
                              sa.String(length=36),
                              nullable=False),
                    sa.Column('image_id', sa.String(length=36), nullable=True),
                    sa.Column('image_username',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('node_processes',
                              st.JsonEncoded(),
                              nullable=True),
                    sa.Column('node_configs', st.JsonEncoded(), nullable=True),
                    sa.Column('volumes_per_node', sa.Integer(), nullable=True),
                    sa.Column('volumes_size', sa.Integer(), nullable=True),
                    sa.Column('volume_mount_prefix',
                              sa.String(length=80),
                              nullable=True),
                    sa.Column('count', sa.Integer(), nullable=False),
                    sa.Column('cluster_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('node_group_template_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('floating_ip_pool',
                              sa.String(length=36),
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['cluster_id'],
                        ['clusters.id'],
                    ),
                    sa.ForeignKeyConstraint(
                        ['node_group_template_id'],
                        ['node_group_templates.id'],
                    ),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', 'cluster_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)

    op.create_table('instances',
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('tenant_id', sa.String(length=36),
                              nullable=True),
                    sa.Column('node_group_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('instance_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('instance_name',
                              sa.String(length=80),
                              nullable=False),
                    sa.Column('internal_ip',
                              sa.String(length=15),
                              nullable=True),
                    sa.Column('management_ip',
                              sa.String(length=15),
                              nullable=True),
                    sa.Column('volumes', st.JsonEncoded(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['node_group_id'],
                        ['node_groups.id'],
                    ),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('instance_id', 'node_group_id'),
                    mysql_engine=MYSQL_ENGINE,
                    mysql_charset=MYSQL_CHARSET)