dbos 1.14.0a9__py3-none-any.whl → 1.15.0a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dbos might be problematic. Click here for more details.
- dbos/_client.py +30 -35
- dbos/_context.py +12 -6
- dbos/_core.py +5 -8
- dbos/_dbos.py +15 -27
- dbos/_dbos_config.py +32 -42
- dbos/_debouncer.py +1 -7
- dbos/_debug.py +0 -8
- dbos/_docker_pg_helper.py +93 -51
- dbos/_fastapi.py +5 -1
- dbos/_logger.py +18 -21
- dbos/_migration.py +4 -41
- dbos/_serialization.py +19 -30
- dbos/_sys_db_postgres.py +2 -9
- dbos/_templates/dbos-db-starter/migrations/create_table.py.dbos +34 -0
- dbos/_tracer.py +42 -31
- dbos/_workflow_commands.py +9 -5
- dbos/cli/_github_init.py +22 -16
- dbos/cli/_template_init.py +5 -16
- dbos/cli/cli.py +27 -33
- dbos/cli/migration.py +15 -10
- {dbos-1.14.0a9.dist-info → dbos-1.15.0a2.dist-info}/METADATA +8 -16
- dbos-1.15.0a2.dist-info/RECORD +59 -0
- dbos/_alembic_migrations/env.py +0 -62
- dbos/_alembic_migrations/script.py.mako +0 -26
- dbos/_alembic_migrations/versions/01ce9f07bd10_streaming.py +0 -42
- dbos/_alembic_migrations/versions/04ca4f231047_workflow_queues_executor_id.py +0 -34
- dbos/_alembic_migrations/versions/27ac6900c6ad_add_queue_dedup.py +0 -45
- dbos/_alembic_migrations/versions/471b60d64126_dbos_migrations.py +0 -35
- dbos/_alembic_migrations/versions/50f3227f0b4b_fix_job_queue.py +0 -35
- dbos/_alembic_migrations/versions/5c361fc04708_added_system_tables.py +0 -193
- dbos/_alembic_migrations/versions/66478e1b95e5_consolidate_queues.py +0 -71
- dbos/_alembic_migrations/versions/83f3732ae8e7_workflow_timeout.py +0 -44
- dbos/_alembic_migrations/versions/933e86bdac6a_add_queue_priority.py +0 -35
- dbos/_alembic_migrations/versions/a3b18ad34abe_added_triggers.py +0 -72
- dbos/_alembic_migrations/versions/d76646551a6b_job_queue_limiter.py +0 -43
- dbos/_alembic_migrations/versions/d76646551a6c_workflow_queue.py +0 -28
- dbos/_alembic_migrations/versions/d994145b47b6_consolidate_inputs.py +0 -30
- dbos/_alembic_migrations/versions/eab0cc1d9a14_job_queue.py +0 -56
- dbos/_alembic_migrations/versions/f4b9b32ba814_functionname_childid_op_outputs.py +0 -46
- dbos/_templates/dbos-db-starter/alembic.ini +0 -116
- dbos/_templates/dbos-db-starter/migrations/env.py.dbos +0 -85
- dbos/_templates/dbos-db-starter/migrations/script.py.mako +0 -26
- dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py +0 -35
- dbos-1.14.0a9.dist-info/RECORD +0 -79
- {dbos-1.14.0a9.dist-info → dbos-1.15.0a2.dist-info}/WHEEL +0 -0
- {dbos-1.14.0a9.dist-info → dbos-1.15.0a2.dist-info}/entry_points.txt +0 -0
- {dbos-1.14.0a9.dist-info → dbos-1.15.0a2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Fix job queue PK.
|
|
3
|
-
|
|
4
|
-
Revision ID: 50f3227f0b4b
|
|
5
|
-
Revises: eab0cc1d9a14
|
|
6
|
-
Create Date: 2024-09-25 14:03:53.308068
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from typing import Sequence, Union
|
|
11
|
-
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "50f3227f0b4b"
|
|
16
|
-
down_revision: Union[str, None] = "eab0cc1d9a14"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
op.drop_constraint("job_queue_pkey", "job_queue", schema="dbos", type_="primary")
|
|
23
|
-
|
|
24
|
-
op.create_primary_key(
|
|
25
|
-
"job_queue_pkey", "job_queue", ["workflow_uuid"], schema="dbos"
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def downgrade() -> None:
|
|
30
|
-
# Reverting the changes
|
|
31
|
-
op.drop_constraint("job_queue_pkey", "job_queue", schema="dbos", type_="primary")
|
|
32
|
-
|
|
33
|
-
op.create_primary_key(
|
|
34
|
-
"job_queue_pkey", "job_queue", ["created_at_epoch_ms"], schema="dbos"
|
|
35
|
-
)
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Add system tables.
|
|
3
|
-
|
|
4
|
-
Revision ID: 5c361fc04708
|
|
5
|
-
Revises:
|
|
6
|
-
Create Date: 2024-07-21 13:06:13.724602
|
|
7
|
-
# mypy: allow-untyped-defs, allow-untyped-calls
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from typing import Sequence, Union
|
|
11
|
-
|
|
12
|
-
import sqlalchemy as sa
|
|
13
|
-
from alembic import op
|
|
14
|
-
|
|
15
|
-
# revision identifiers, used by Alembic.
|
|
16
|
-
revision: str = "5c361fc04708"
|
|
17
|
-
down_revision: Union[str, None] = None
|
|
18
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
19
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def upgrade() -> None:
|
|
23
|
-
op.execute(sa.schema.CreateSchema(name="dbos", if_not_exists=True))
|
|
24
|
-
op.execute('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";')
|
|
25
|
-
|
|
26
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
27
|
-
op.create_table(
|
|
28
|
-
"scheduler_state",
|
|
29
|
-
sa.Column("workflow_fn_name", sa.Text(), nullable=False),
|
|
30
|
-
sa.Column("last_run_time", sa.BigInteger(), nullable=False),
|
|
31
|
-
sa.PrimaryKeyConstraint("workflow_fn_name"),
|
|
32
|
-
schema="dbos",
|
|
33
|
-
)
|
|
34
|
-
op.create_table(
|
|
35
|
-
"workflow_status",
|
|
36
|
-
sa.Column("workflow_uuid", sa.Text(), nullable=False),
|
|
37
|
-
sa.Column("status", sa.Text(), nullable=True),
|
|
38
|
-
sa.Column("name", sa.Text(), nullable=True),
|
|
39
|
-
sa.Column("authenticated_user", sa.Text(), nullable=True),
|
|
40
|
-
sa.Column("assumed_role", sa.Text(), nullable=True),
|
|
41
|
-
sa.Column("authenticated_roles", sa.Text(), nullable=True),
|
|
42
|
-
sa.Column("request", sa.Text(), nullable=True),
|
|
43
|
-
sa.Column("output", sa.Text(), nullable=True),
|
|
44
|
-
sa.Column("error", sa.Text(), nullable=True),
|
|
45
|
-
sa.Column("executor_id", sa.Text(), nullable=True),
|
|
46
|
-
sa.Column(
|
|
47
|
-
"created_at",
|
|
48
|
-
sa.BigInteger(),
|
|
49
|
-
server_default=sa.text(
|
|
50
|
-
"(EXTRACT(epoch FROM now()) * 1000::numeric)::bigint"
|
|
51
|
-
),
|
|
52
|
-
nullable=False,
|
|
53
|
-
),
|
|
54
|
-
sa.Column(
|
|
55
|
-
"updated_at",
|
|
56
|
-
sa.BigInteger(),
|
|
57
|
-
server_default=sa.text(
|
|
58
|
-
"(EXTRACT(epoch FROM now()) * 1000::numeric)::bigint"
|
|
59
|
-
),
|
|
60
|
-
nullable=False,
|
|
61
|
-
),
|
|
62
|
-
sa.Column("application_version", sa.Text(), nullable=True),
|
|
63
|
-
sa.Column("application_id", sa.Text(), nullable=True),
|
|
64
|
-
sa.Column(
|
|
65
|
-
"class_name",
|
|
66
|
-
sa.String(length=255),
|
|
67
|
-
server_default=sa.text("NULL"),
|
|
68
|
-
nullable=True,
|
|
69
|
-
),
|
|
70
|
-
sa.Column(
|
|
71
|
-
"config_name",
|
|
72
|
-
sa.String(length=255),
|
|
73
|
-
server_default=sa.text("NULL"),
|
|
74
|
-
nullable=True,
|
|
75
|
-
),
|
|
76
|
-
sa.Column(
|
|
77
|
-
"recovery_attempts",
|
|
78
|
-
sa.BigInteger(),
|
|
79
|
-
server_default=sa.text("'0'::bigint"),
|
|
80
|
-
nullable=True,
|
|
81
|
-
),
|
|
82
|
-
sa.PrimaryKeyConstraint("workflow_uuid"),
|
|
83
|
-
schema="dbos",
|
|
84
|
-
)
|
|
85
|
-
op.create_index(
|
|
86
|
-
"workflow_status_created_at_index",
|
|
87
|
-
"workflow_status",
|
|
88
|
-
["created_at"],
|
|
89
|
-
unique=False,
|
|
90
|
-
schema="dbos",
|
|
91
|
-
)
|
|
92
|
-
op.create_index(
|
|
93
|
-
"workflow_status_executor_id_index",
|
|
94
|
-
"workflow_status",
|
|
95
|
-
["executor_id"],
|
|
96
|
-
unique=False,
|
|
97
|
-
schema="dbos",
|
|
98
|
-
)
|
|
99
|
-
op.create_table(
|
|
100
|
-
"notifications",
|
|
101
|
-
sa.Column("destination_uuid", sa.Text(), nullable=False),
|
|
102
|
-
sa.Column("topic", sa.Text(), nullable=True),
|
|
103
|
-
sa.Column("message", sa.Text(), nullable=False),
|
|
104
|
-
sa.Column(
|
|
105
|
-
"created_at_epoch_ms",
|
|
106
|
-
sa.BigInteger(),
|
|
107
|
-
server_default=sa.text(
|
|
108
|
-
"(EXTRACT(epoch FROM now()) * 1000::numeric)::bigint"
|
|
109
|
-
),
|
|
110
|
-
nullable=False,
|
|
111
|
-
),
|
|
112
|
-
sa.Column(
|
|
113
|
-
"message_uuid",
|
|
114
|
-
sa.Text(),
|
|
115
|
-
server_default=sa.text("uuid_generate_v4()"),
|
|
116
|
-
nullable=False,
|
|
117
|
-
),
|
|
118
|
-
sa.ForeignKeyConstraint(
|
|
119
|
-
["destination_uuid"],
|
|
120
|
-
["dbos.workflow_status.workflow_uuid"],
|
|
121
|
-
onupdate="CASCADE",
|
|
122
|
-
ondelete="CASCADE",
|
|
123
|
-
),
|
|
124
|
-
schema="dbos",
|
|
125
|
-
)
|
|
126
|
-
op.create_index(
|
|
127
|
-
"idx_workflow_topic",
|
|
128
|
-
"notifications",
|
|
129
|
-
["destination_uuid", "topic"],
|
|
130
|
-
unique=False,
|
|
131
|
-
schema="dbos",
|
|
132
|
-
)
|
|
133
|
-
op.create_table(
|
|
134
|
-
"operation_outputs",
|
|
135
|
-
sa.Column("workflow_uuid", sa.Text(), nullable=False),
|
|
136
|
-
sa.Column("function_id", sa.Integer(), nullable=False),
|
|
137
|
-
sa.Column("output", sa.Text(), nullable=True),
|
|
138
|
-
sa.Column("error", sa.Text(), nullable=True),
|
|
139
|
-
sa.ForeignKeyConstraint(
|
|
140
|
-
["workflow_uuid"],
|
|
141
|
-
["dbos.workflow_status.workflow_uuid"],
|
|
142
|
-
onupdate="CASCADE",
|
|
143
|
-
ondelete="CASCADE",
|
|
144
|
-
),
|
|
145
|
-
sa.PrimaryKeyConstraint("workflow_uuid", "function_id"),
|
|
146
|
-
schema="dbos",
|
|
147
|
-
)
|
|
148
|
-
op.create_table(
|
|
149
|
-
"workflow_events",
|
|
150
|
-
sa.Column("workflow_uuid", sa.Text(), nullable=False),
|
|
151
|
-
sa.Column("key", sa.Text(), nullable=False),
|
|
152
|
-
sa.Column("value", sa.Text(), nullable=False),
|
|
153
|
-
sa.ForeignKeyConstraint(
|
|
154
|
-
["workflow_uuid"],
|
|
155
|
-
["dbos.workflow_status.workflow_uuid"],
|
|
156
|
-
onupdate="CASCADE",
|
|
157
|
-
ondelete="CASCADE",
|
|
158
|
-
),
|
|
159
|
-
sa.PrimaryKeyConstraint("workflow_uuid", "key"),
|
|
160
|
-
schema="dbos",
|
|
161
|
-
)
|
|
162
|
-
op.create_table(
|
|
163
|
-
"workflow_inputs",
|
|
164
|
-
sa.Column("workflow_uuid", sa.Text(), nullable=False),
|
|
165
|
-
sa.Column("inputs", sa.Text(), nullable=False),
|
|
166
|
-
sa.ForeignKeyConstraint(
|
|
167
|
-
["workflow_uuid"],
|
|
168
|
-
["dbos.workflow_status.workflow_uuid"],
|
|
169
|
-
onupdate="CASCADE",
|
|
170
|
-
ondelete="CASCADE",
|
|
171
|
-
),
|
|
172
|
-
sa.PrimaryKeyConstraint("workflow_uuid"),
|
|
173
|
-
schema="dbos",
|
|
174
|
-
)
|
|
175
|
-
# ### end Alembic commands ###
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
def downgrade() -> None:
|
|
179
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
180
|
-
op.drop_table("workflow_inputs", schema="dbos")
|
|
181
|
-
op.drop_table("workflow_events", schema="dbos")
|
|
182
|
-
op.drop_table("operation_outputs", schema="dbos")
|
|
183
|
-
op.drop_index("idx_workflow_topic", table_name="notifications", schema="dbos")
|
|
184
|
-
op.drop_table("notifications", schema="dbos")
|
|
185
|
-
op.drop_index(
|
|
186
|
-
"workflow_status_executor_id_index", table_name="workflow_status", schema="dbos"
|
|
187
|
-
)
|
|
188
|
-
op.drop_index(
|
|
189
|
-
"workflow_status_created_at_index", table_name="workflow_status", schema="dbos"
|
|
190
|
-
)
|
|
191
|
-
op.drop_table("workflow_status", schema="dbos")
|
|
192
|
-
op.drop_table("scheduler_state", schema="dbos")
|
|
193
|
-
# ### end Alembic commands ###
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"""consolidate_queues
|
|
2
|
-
|
|
3
|
-
Revision ID: 66478e1b95e5
|
|
4
|
-
Revises: 933e86bdac6a
|
|
5
|
-
Create Date: 2025-05-21 10:14:25.674613
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "66478e1b95e5"
|
|
16
|
-
down_revision: Union[str, None] = "933e86bdac6a"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# Add new columns to workflow_status table
|
|
23
|
-
op.add_column(
|
|
24
|
-
"workflow_status",
|
|
25
|
-
sa.Column("started_at_epoch_ms", sa.BigInteger(), nullable=True),
|
|
26
|
-
schema="dbos",
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
op.add_column(
|
|
30
|
-
"workflow_status",
|
|
31
|
-
sa.Column("deduplication_id", sa.Text(), nullable=True),
|
|
32
|
-
schema="dbos",
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
op.add_column(
|
|
36
|
-
"workflow_status",
|
|
37
|
-
sa.Column(
|
|
38
|
-
"priority", sa.Integer(), nullable=False, server_default=sa.text("'0'::int")
|
|
39
|
-
),
|
|
40
|
-
schema="dbos",
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# Add unique constraint for deduplication_id
|
|
44
|
-
op.create_unique_constraint(
|
|
45
|
-
"uq_workflow_status_queue_name_dedup_id",
|
|
46
|
-
"workflow_status",
|
|
47
|
-
["queue_name", "deduplication_id"],
|
|
48
|
-
schema="dbos",
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
# Add index on status field
|
|
52
|
-
op.create_index(
|
|
53
|
-
"workflow_status_status_index", "workflow_status", ["status"], schema="dbos"
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def downgrade() -> None:
|
|
58
|
-
# Drop indexes
|
|
59
|
-
op.drop_index(
|
|
60
|
-
"workflow_status_status_index", table_name="workflow_status", schema="dbos"
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
# Drop unique constraint
|
|
64
|
-
op.drop_constraint(
|
|
65
|
-
"uq_workflow_status_queue_name_dedup_id", "workflow_status", schema="dbos"
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
# Drop columns
|
|
69
|
-
op.drop_column("workflow_status", "priority", schema="dbos")
|
|
70
|
-
op.drop_column("workflow_status", "deduplication_id", schema="dbos")
|
|
71
|
-
op.drop_column("workflow_status", "started_at_epoch_ms", schema="dbos")
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"""workflow_timeout
|
|
2
|
-
|
|
3
|
-
Revision ID: 83f3732ae8e7
|
|
4
|
-
Revises: f4b9b32ba814
|
|
5
|
-
Create Date: 2025-04-16 17:05:36.642395
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "83f3732ae8e7"
|
|
16
|
-
down_revision: Union[str, None] = "f4b9b32ba814"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
op.add_column(
|
|
23
|
-
"workflow_status",
|
|
24
|
-
sa.Column(
|
|
25
|
-
"workflow_timeout_ms",
|
|
26
|
-
sa.BigInteger(),
|
|
27
|
-
nullable=True,
|
|
28
|
-
),
|
|
29
|
-
schema="dbos",
|
|
30
|
-
)
|
|
31
|
-
op.add_column(
|
|
32
|
-
"workflow_status",
|
|
33
|
-
sa.Column(
|
|
34
|
-
"workflow_deadline_epoch_ms",
|
|
35
|
-
sa.BigInteger(),
|
|
36
|
-
nullable=True,
|
|
37
|
-
),
|
|
38
|
-
schema="dbos",
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def downgrade() -> None:
|
|
43
|
-
op.drop_column("workflow_status", "workflow_deadline_epoch_ms", schema="dbos")
|
|
44
|
-
op.drop_column("workflow_status", "workflow_timeout_ms", schema="dbos")
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"""add queue priority
|
|
2
|
-
|
|
3
|
-
Revision ID: 933e86bdac6a
|
|
4
|
-
Revises: 27ac6900c6ad
|
|
5
|
-
Create Date: 2025-04-25 18:17:40.462737
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "933e86bdac6a"
|
|
16
|
-
down_revision: Union[str, None] = "27ac6900c6ad"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
op.add_column(
|
|
23
|
-
"workflow_queue",
|
|
24
|
-
sa.Column(
|
|
25
|
-
"priority",
|
|
26
|
-
sa.Integer(),
|
|
27
|
-
nullable=False,
|
|
28
|
-
server_default=sa.text("'0'::int"),
|
|
29
|
-
),
|
|
30
|
-
schema="dbos",
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def downgrade() -> None:
|
|
35
|
-
op.drop_column("workflow_queue", "priority", schema="dbos")
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Add triggers.
|
|
3
|
-
|
|
4
|
-
Revision ID: a3b18ad34abe
|
|
5
|
-
Revises: 5c361fc04708
|
|
6
|
-
Create Date: 2024-07-21 13:07:09.814989
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
from alembic import op
|
|
12
|
-
|
|
13
|
-
# revision identifiers, used by Alembic.
|
|
14
|
-
revision: str = "a3b18ad34abe"
|
|
15
|
-
down_revision: Union[str, None] = "5c361fc04708"
|
|
16
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
17
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def upgrade() -> None:
|
|
21
|
-
|
|
22
|
-
op.execute(
|
|
23
|
-
"""
|
|
24
|
-
CREATE OR REPLACE FUNCTION dbos.notifications_function() RETURNS TRIGGER AS $$
|
|
25
|
-
DECLARE
|
|
26
|
-
payload text := NEW.destination_uuid || '::' || NEW.topic;
|
|
27
|
-
BEGIN
|
|
28
|
-
PERFORM pg_notify('dbos_notifications_channel', payload);
|
|
29
|
-
RETURN NEW;
|
|
30
|
-
END;
|
|
31
|
-
$$ LANGUAGE plpgsql;
|
|
32
|
-
"""
|
|
33
|
-
)
|
|
34
|
-
op.execute(
|
|
35
|
-
"""
|
|
36
|
-
CREATE TRIGGER dbos_notifications_trigger
|
|
37
|
-
AFTER INSERT ON dbos.notifications
|
|
38
|
-
FOR EACH ROW EXECUTE FUNCTION dbos.notifications_function();
|
|
39
|
-
"""
|
|
40
|
-
)
|
|
41
|
-
op.execute(
|
|
42
|
-
"""
|
|
43
|
-
CREATE OR REPLACE FUNCTION dbos.workflow_events_function() RETURNS TRIGGER AS $$
|
|
44
|
-
DECLARE
|
|
45
|
-
payload text := NEW.workflow_uuid || '::' || NEW.key;
|
|
46
|
-
BEGIN
|
|
47
|
-
PERFORM pg_notify('dbos_workflow_events_channel', payload);
|
|
48
|
-
RETURN NEW;
|
|
49
|
-
END;
|
|
50
|
-
$$ LANGUAGE plpgsql;
|
|
51
|
-
"""
|
|
52
|
-
)
|
|
53
|
-
op.execute(
|
|
54
|
-
"""
|
|
55
|
-
CREATE TRIGGER dbos_workflow_events_trigger
|
|
56
|
-
AFTER INSERT ON dbos.workflow_events
|
|
57
|
-
FOR EACH ROW EXECUTE FUNCTION dbos.workflow_events_function();
|
|
58
|
-
"""
|
|
59
|
-
)
|
|
60
|
-
# ### end Alembic commands ###
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def downgrade() -> None:
|
|
64
|
-
op.execute(
|
|
65
|
-
"DROP TRIGGER IF EXISTS dbos_notifications_trigger ON dbos.notifications;"
|
|
66
|
-
)
|
|
67
|
-
op.execute("DROP FUNCTION IF EXISTS dbos.notifications_function;")
|
|
68
|
-
op.execute(
|
|
69
|
-
"DROP TRIGGER IF EXISTS dbos_workflow_events_trigger ON dbos.workflow_events;"
|
|
70
|
-
)
|
|
71
|
-
op.execute("DROP FUNCTION IF EXISTS dbos.workflow_events_function;")
|
|
72
|
-
# ### end Alembic commands ###
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Adjust workflow queue to add columns for rate limiter.
|
|
3
|
-
|
|
4
|
-
Revision ID: d76646551a6b
|
|
5
|
-
Revises: 50f3227f0b4b
|
|
6
|
-
Create Date: 2024-09-25 14:48:10.218015
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from typing import Sequence, Union
|
|
11
|
-
|
|
12
|
-
import sqlalchemy as sa
|
|
13
|
-
from alembic import op
|
|
14
|
-
|
|
15
|
-
# revision identifiers, used by Alembic.
|
|
16
|
-
revision: str = "d76646551a6b"
|
|
17
|
-
down_revision: Union[str, None] = "50f3227f0b4b"
|
|
18
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
19
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def upgrade() -> None:
|
|
23
|
-
op.add_column(
|
|
24
|
-
"job_queue",
|
|
25
|
-
sa.Column(
|
|
26
|
-
"started_at_epoch_ms",
|
|
27
|
-
sa.BigInteger(),
|
|
28
|
-
),
|
|
29
|
-
schema="dbos",
|
|
30
|
-
)
|
|
31
|
-
op.add_column(
|
|
32
|
-
"job_queue",
|
|
33
|
-
sa.Column(
|
|
34
|
-
"completed_at_epoch_ms",
|
|
35
|
-
sa.BigInteger(),
|
|
36
|
-
),
|
|
37
|
-
schema="dbos",
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def downgrade() -> None:
|
|
42
|
-
op.drop_column("job_queue", "started_at_epoch_ms", schema="dbos")
|
|
43
|
-
op.drop_column("job_queue", "completed_at_epoch_ms", schema="dbos")
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"""workflow_queue
|
|
2
|
-
|
|
3
|
-
Revision ID: d76646551a6c
|
|
4
|
-
Revises: d76646551a6b
|
|
5
|
-
Create Date: 2024-09-27 12:00:00.0
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "d76646551a6c"
|
|
16
|
-
down_revision: Union[str, None] = "d76646551a6b"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
op.rename_table("job_queue", "workflow_queue", schema="dbos")
|
|
23
|
-
op.execute("CREATE VIEW dbos.job_queue AS SELECT * FROM dbos.workflow_queue;")
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def downgrade() -> None:
|
|
27
|
-
op.execute("DROP VIEW dbos.job_queue;")
|
|
28
|
-
op.rename_table("workflow_queue", "job_queue", schema="dbos")
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"""consolidate_inputs
|
|
2
|
-
|
|
3
|
-
Revision ID: d994145b47b6
|
|
4
|
-
Revises: 66478e1b95e5
|
|
5
|
-
Create Date: 2025-05-23 08:09:15.515009
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "d994145b47b6"
|
|
16
|
-
down_revision: Union[str, None] = "66478e1b95e5"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
op.add_column(
|
|
23
|
-
"workflow_status",
|
|
24
|
-
sa.Column("inputs", sa.Text(), nullable=True),
|
|
25
|
-
schema="dbos",
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def downgrade() -> None:
|
|
30
|
-
op.drop_column("workflow_status", "inputs", schema="dbos")
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Add workflow queue table.
|
|
3
|
-
|
|
4
|
-
Revision ID: eab0cc1d9a14
|
|
5
|
-
Revises: a3b18ad34abe
|
|
6
|
-
Create Date: 2024-09-13 14:50:00.531294
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from typing import Sequence, Union
|
|
11
|
-
|
|
12
|
-
import sqlalchemy as sa
|
|
13
|
-
from alembic import op
|
|
14
|
-
|
|
15
|
-
# revision identifiers, used by Alembic.
|
|
16
|
-
revision: str = "eab0cc1d9a14"
|
|
17
|
-
down_revision: Union[str, None] = "a3b18ad34abe"
|
|
18
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
19
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def upgrade() -> None:
|
|
23
|
-
op.create_table(
|
|
24
|
-
"job_queue",
|
|
25
|
-
sa.Column("workflow_uuid", sa.Text(), nullable=False),
|
|
26
|
-
sa.Column("queue_name", sa.Text(), nullable=False),
|
|
27
|
-
sa.Column(
|
|
28
|
-
"created_at_epoch_ms",
|
|
29
|
-
sa.BigInteger(),
|
|
30
|
-
server_default=sa.text(
|
|
31
|
-
"(EXTRACT(epoch FROM now()) * 1000::numeric)::bigint"
|
|
32
|
-
),
|
|
33
|
-
nullable=False,
|
|
34
|
-
primary_key=True,
|
|
35
|
-
),
|
|
36
|
-
sa.ForeignKeyConstraint(
|
|
37
|
-
["workflow_uuid"],
|
|
38
|
-
["dbos.workflow_status.workflow_uuid"],
|
|
39
|
-
onupdate="CASCADE",
|
|
40
|
-
ondelete="CASCADE",
|
|
41
|
-
),
|
|
42
|
-
schema="dbos",
|
|
43
|
-
)
|
|
44
|
-
op.add_column(
|
|
45
|
-
"workflow_status",
|
|
46
|
-
sa.Column(
|
|
47
|
-
"queue_name",
|
|
48
|
-
sa.Text(),
|
|
49
|
-
),
|
|
50
|
-
schema="dbos",
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def downgrade() -> None:
|
|
55
|
-
op.drop_table("job_queue", schema="dbos")
|
|
56
|
-
op.drop_column("workflow_status", "queue_name", schema="dbos")
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"""functionname_childid_op_outputs
|
|
2
|
-
|
|
3
|
-
Revision ID: f4b9b32ba814
|
|
4
|
-
Revises: 04ca4f231047
|
|
5
|
-
Create Date: 2025-03-21 14:32:43.091074
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from alembic import op
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = "f4b9b32ba814"
|
|
16
|
-
down_revision: Union[str, None] = "04ca4f231047"
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
op.add_column(
|
|
23
|
-
"operation_outputs",
|
|
24
|
-
sa.Column(
|
|
25
|
-
"function_name",
|
|
26
|
-
sa.Text(),
|
|
27
|
-
nullable=False,
|
|
28
|
-
server_default="",
|
|
29
|
-
),
|
|
30
|
-
schema="dbos",
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
op.add_column(
|
|
34
|
-
"operation_outputs",
|
|
35
|
-
sa.Column(
|
|
36
|
-
"child_workflow_id",
|
|
37
|
-
sa.Text(),
|
|
38
|
-
nullable=True,
|
|
39
|
-
),
|
|
40
|
-
schema="dbos",
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def downgrade() -> None:
|
|
45
|
-
op.drop_column("operation_outputs", "function_name", schema="dbos")
|
|
46
|
-
op.drop_column("operation_outputs", "child_workflow_id", schema="dbos")
|