Skip to content

Commit ceb4f7c

Browse files
committed
Features: job status table with related DB model, migration files, job status tracking.
Added status wrapper to handle job status updates in the DB. Added filtration using job_id to fetch job status responses. fix: Generate job response from vertex builds history by job id. (#11457) * feat: reconstruct workflow execution response from vertex_build by job_id * [autofix.ci] apply automated fixes * fix: use correct attribute name 'id' instead of 'vertex_id' in VertexBuildTable * Updated the GET endpoint to return WorkflowExecutionResponse --------- Co-authored-by: Janardan S Kavia <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Added /stop endpoint, task handling, job_id typing through job_service, job_status updates.
1 parent a097b68 commit ceb4f7c

28 files changed

+2979
-65
lines changed

db_dump.json

Lines changed: 2008 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Changed job_id in JobTable to be UUID instead of string
2+
3+
Revision ID: 00e5ef437a72
4+
Revises: dd3dd875cd97
5+
Create Date: 2026-01-25 21:32:44.515850
6+
7+
Phase: MIGRATE
8+
"""
9+
10+
from collections.abc import Sequence
11+
12+
import sqlalchemy as sa
13+
from alembic import op
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "00e5ef437a72" # pragma: allowlist secret
17+
down_revision: str | None = "dd3dd875cd97" # pragma: allowlist secret
18+
branch_labels: str | Sequence[str] | None = None
19+
depends_on: str | Sequence[str] | None = None
20+
21+
22+
def upgrade() -> None:
23+
# ### commands auto generated by Alembic - please adjust! ###
24+
with op.batch_alter_table("job", schema=None) as batch_op:
25+
batch_op.alter_column("job_id", existing_type=sa.VARCHAR(), type_=sa.Uuid(), existing_nullable=False)
26+
27+
# ### end Alembic commands ###
28+
29+
30+
def downgrade() -> None:
31+
# ### commands auto generated by Alembic - please adjust! ###
32+
with op.batch_alter_table("job", schema=None) as batch_op:
33+
batch_op.alter_column("job_id", existing_type=sa.Uuid(), type_=sa.VARCHAR(), existing_nullable=False)
34+
35+
# ### end Alembic commands ###
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Changed job_id in vertex_build table to be UUID instead of str.
2+
3+
Revision ID: dd3dd875cd97
4+
Revises: f7a564a956a8
5+
Create Date: 2026-01-25 20:23:02.795268
6+
7+
Phase: MIGRATE
8+
"""
9+
10+
from collections.abc import Sequence
11+
12+
import sqlalchemy as sa
13+
from alembic import op
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "dd3dd875cd97"
17+
down_revision: str | None = "f7a564a956a8"
18+
branch_labels: str | Sequence[str] | None = None
19+
depends_on: str | Sequence[str] | None = None
20+
21+
22+
def upgrade() -> None:
23+
# ### commands auto generated by Alembic - please adjust! ###
24+
with op.batch_alter_table("vertex_build", schema=None) as batch_op:
25+
batch_op.alter_column("job_id", existing_type=sa.VARCHAR(), type_=sa.Uuid(), existing_nullable=True)
26+
27+
# ### end Alembic commands ###
28+
29+
30+
def downgrade() -> None:
31+
# ### commands auto generated by Alembic - please adjust! ###
32+
with op.batch_alter_table("vertex_build", schema=None) as batch_op:
33+
batch_op.alter_column("job_id", existing_type=sa.Uuid(), type_=sa.VARCHAR(), existing_nullable=True)
34+
35+
# ### end Alembic commands ###
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
"""Add job_id to vertex_build, create job_id status model
2+
3+
Revision ID: f7a564a956a8
4+
Revises: 182e5471b900
5+
Create Date: 2026-01-25 19:07:45.358554
6+
7+
Phase: EXPAND
8+
"""
9+
10+
from collections.abc import Sequence
11+
12+
import sqlalchemy as sa
13+
import sqlmodel
14+
from alembic import op
15+
16+
# revision identifiers, used by Alembic.
17+
revision: str = "f7a564a956a8"
18+
down_revision: str | None = "182e5471b900" # pragma: allowlist secret
19+
branch_labels: str | Sequence[str] | None = None
20+
depends_on: str | Sequence[str] | None = None
21+
22+
23+
def upgrade() -> None:
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
op.create_table(
26+
"job",
27+
sa.Column("job_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
28+
sa.Column("flow_id", sa.Uuid(), nullable=False),
29+
sa.Column(
30+
"status",
31+
sa.Enum("queued", "in_progress", "completed", "failed", "cancelled", "timed_out", name="job_status_enum"),
32+
nullable=False,
33+
),
34+
sa.Column("created_timestamp", sa.DateTime(timezone=True), nullable=False),
35+
sa.Column("finished_timestamp", sa.DateTime(timezone=True), nullable=True),
36+
sa.PrimaryKeyConstraint("job_id"),
37+
)
38+
with op.batch_alter_table("job", schema=None) as batch_op:
39+
batch_op.create_index(batch_op.f("ix_job_flow_id"), ["flow_id"], unique=False)
40+
batch_op.create_index(batch_op.f("ix_job_job_id"), ["job_id"], unique=False)
41+
batch_op.create_index(batch_op.f("ix_job_status"), ["status"], unique=False)
42+
43+
with op.batch_alter_table("vertex_build", schema=None) as batch_op:
44+
batch_op.add_column(sa.Column("job_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True))
45+
batch_op.create_index(batch_op.f("ix_vertex_build_job_id"), ["job_id"], unique=False)
46+
47+
# ### end Alembic commands ###
48+
49+
50+
def downgrade() -> None:
51+
# ### commands auto generated by Alembic - please adjust! ###
52+
with op.batch_alter_table("vertex_build", schema=None) as batch_op:
53+
batch_op.drop_index(batch_op.f("ix_vertex_build_job_id"))
54+
batch_op.drop_column("job_id")
55+
56+
with op.batch_alter_table("job", schema=None) as batch_op:
57+
batch_op.drop_index(batch_op.f("ix_job_status"))
58+
batch_op.drop_index(batch_op.f("ix_job_job_id"))
59+
batch_op.drop_index(batch_op.f("ix_job_flow_id"))
60+
61+
op.drop_table("job")
62+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)