Skip to content

Commit 2d67402

Browse files
feat: Job execution status endpoint, status tracking, DB models (#11438)
* 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 <janardanskavia@Janardans-MacBook-Pro.local> 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. Consolidated migration files into one single migration. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 2f4b7d6 commit 2d67402

58 files changed

Lines changed: 1359 additions & 170 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.secrets.baseline

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,15 @@
917917
"filename": "src/backend/tests/conftest.py",
918918
"hashed_secret": "8bb6118f8fd6935ad0876a3be34a717d32708ffd",
919919
"is_verified": false,
920-
"line_number": 427,
920+
"line_number": 481,
921921
"is_secret": false
922922
},
923923
{
924924
"type": "Secret Keyword",
925925
"filename": "src/backend/tests/conftest.py",
926926
"hashed_secret": "61fbb5a12cd7b1f1fe1624120089efc0cd299e43",
927927
"is_verified": false,
928-
"line_number": 639,
928+
"line_number": 691,
929929
"is_secret": false
930930
}
931931
],
@@ -1528,5 +1528,5 @@
15281528
}
15291529
]
15301530
},
1531-
"generated_at": "2026-01-21T13:04:28Z"
1531+
"generated_at": "2026-01-28T21:22:05Z"
15321532
}

src/backend/base/langflow/alembic/migration_validator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ def main():
351351
logging.basicConfig(level=logging.INFO)
352352
logger = logging.getLogger("migration_validator")
353353
if args.json:
354-
logger.info(json.dumps(results, indent=2))
354+
import sys as _sys
355+
356+
_sys.stdout.write(json.dumps(results, indent=2) + "\n")
355357
else:
356358
for result in results:
357359
logger.info("\n%s", "=" * 60)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"""add job_id to vertex_build, create job status table.
2+
3+
Revision ID: 369268b9af8b
4+
Revises: 182e5471b900
5+
Create Date: 2026-01-28 13:00:52.967282
6+
7+
Phase: EXPAND
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 = "369268b9af8b" # pragma: allowlist secret
17+
down_revision: str | None = "182e5471b900" # 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+
from langflow.utils import migration
25+
26+
conn = op.get_bind()
27+
if not migration.table_exists("job", conn):
28+
op.create_table(
29+
"job",
30+
sa.Column("job_id", sa.Uuid(), nullable=False),
31+
sa.Column("flow_id", sa.Uuid(), nullable=False),
32+
sa.Column(
33+
"status",
34+
sa.Enum(
35+
"queued",
36+
"in_progress",
37+
"completed",
38+
"failed",
39+
"cancelled",
40+
"timed_out",
41+
name="job_status_enum",
42+
),
43+
nullable=False,
44+
),
45+
sa.Column("created_timestamp", sa.DateTime(timezone=True), nullable=False),
46+
sa.Column("finished_timestamp", sa.DateTime(timezone=True), nullable=True),
47+
sa.PrimaryKeyConstraint("job_id"),
48+
)
49+
with op.batch_alter_table("job", schema=None) as batch_op:
50+
batch_op.create_index(batch_op.f("ix_job_flow_id"), ["flow_id"], unique=False)
51+
batch_op.create_index(batch_op.f("ix_job_job_id"), ["job_id"], unique=False)
52+
batch_op.create_index(batch_op.f("ix_job_status"), ["status"], unique=False)
53+
54+
if not migration.column_exists("vertex_build", "job_id", conn):
55+
with op.batch_alter_table("vertex_build", schema=None) as batch_op:
56+
batch_op.add_column(sa.Column("job_id", sa.Uuid(), nullable=True))
57+
batch_op.create_index(batch_op.f("ix_vertex_build_job_id"), ["job_id"], unique=False)
58+
59+
# ### end Alembic commands ###
60+
61+
62+
def downgrade() -> None:
63+
# ### commands auto generated by Alembic - please adjust! ###
64+
with op.batch_alter_table("vertex_build", schema=None) as batch_op:
65+
batch_op.drop_index(batch_op.f("ix_vertex_build_job_id"))
66+
batch_op.drop_column("job_id")
67+
68+
with op.batch_alter_table("job", schema=None) as batch_op:
69+
batch_op.drop_index(batch_op.f("ix_job_status"))
70+
batch_op.drop_index(batch_op.f("ix_job_job_id"))
71+
batch_op.drop_index(batch_op.f("ix_job_flow_id"))
72+
73+
op.drop_table("job")
74+
# ### end Alembic commands ###

src/backend/base/langflow/api/v2/converters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from lfx.schema.workflow import (
2929
ComponentOutput,
3030
ErrorDetail,
31+
JobId,
3132
JobStatus,
3233
WorkflowExecutionRequest,
3334
WorkflowExecutionResponse,
@@ -482,7 +483,7 @@ def create_job_response(job_id: str, flow_id: str) -> WorkflowJobResponse:
482483

483484
def create_error_response(
484485
flow_id: str,
485-
job_id: str | None,
486+
job_id: JobId,
486487
workflow_request: WorkflowExecutionRequest,
487488
error: Exception,
488489
) -> WorkflowExecutionResponse:

0 commit comments

Comments
 (0)