dbos 1.12.0a3__py3-none-any.whl → 1.13.0__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/_alembic_migrations/versions/471b60d64126_dbos_migrations.py +35 -0
- dbos/_app_db.py +215 -80
- dbos/_client.py +30 -15
- dbos/_context.py +4 -0
- dbos/_core.py +7 -8
- dbos/_dbos.py +28 -18
- dbos/_dbos_config.py +124 -50
- dbos/_fastapi.py +1 -1
- dbos/_logger.py +3 -1
- dbos/_migration.py +322 -0
- dbos/_sys_db.py +122 -200
- dbos/_sys_db_postgres.py +173 -0
- dbos/_sys_db_sqlite.py +182 -0
- dbos/_tracer.py +5 -1
- dbos/_utils.py +10 -1
- dbos/cli/cli.py +205 -96
- dbos/cli/migration.py +2 -2
- dbos/dbos-config.schema.json +4 -0
- {dbos-1.12.0a3.dist-info → dbos-1.13.0.dist-info}/METADATA +1 -1
- dbos-1.13.0.dist-info/RECORD +78 -0
- dbos-1.12.0a3.dist-info/RECORD +0 -74
- /dbos/{_migrations → _alembic_migrations}/env.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/script.py.mako +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/01ce9f07bd10_streaming.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/04ca4f231047_workflow_queues_executor_id.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/27ac6900c6ad_add_queue_dedup.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/50f3227f0b4b_fix_job_queue.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/5c361fc04708_added_system_tables.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/66478e1b95e5_consolidate_queues.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/83f3732ae8e7_workflow_timeout.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/933e86bdac6a_add_queue_priority.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/a3b18ad34abe_added_triggers.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/d76646551a6b_job_queue_limiter.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/d76646551a6c_workflow_queue.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/d994145b47b6_consolidate_inputs.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/eab0cc1d9a14_job_queue.py +0 -0
- /dbos/{_migrations → _alembic_migrations}/versions/f4b9b32ba814_functionname_childid_op_outputs.py +0 -0
- {dbos-1.12.0a3.dist-info → dbos-1.13.0.dist-info}/WHEEL +0 -0
- {dbos-1.12.0a3.dist-info → dbos-1.13.0.dist-info}/entry_points.txt +0 -0
- {dbos-1.12.0a3.dist-info → dbos-1.13.0.dist-info}/licenses/LICENSE +0 -0
dbos/cli/cli.py
CHANGED
|
@@ -5,7 +5,7 @@ import subprocess
|
|
|
5
5
|
import time
|
|
6
6
|
import typing
|
|
7
7
|
from os import path
|
|
8
|
-
from typing import Any, Optional
|
|
8
|
+
from typing import Any, Optional, Tuple
|
|
9
9
|
|
|
10
10
|
import jsonpickle # type: ignore
|
|
11
11
|
import sqlalchemy as sa
|
|
@@ -18,62 +18,65 @@ from dbos._context import SetWorkflowID
|
|
|
18
18
|
from dbos._debug import debug_workflow, parse_start_command
|
|
19
19
|
from dbos.cli.migration import grant_dbos_schema_permissions, migrate_dbos_databases
|
|
20
20
|
|
|
21
|
-
from .._app_db import ApplicationDatabase
|
|
22
21
|
from .._client import DBOSClient
|
|
23
22
|
from .._dbos_config import (
|
|
23
|
+
ConfigFile,
|
|
24
24
|
_app_name_to_db_name,
|
|
25
25
|
_is_valid_app_name,
|
|
26
|
+
get_application_database_url,
|
|
26
27
|
get_system_database_url,
|
|
27
|
-
is_valid_database_url,
|
|
28
28
|
load_config,
|
|
29
29
|
)
|
|
30
30
|
from .._docker_pg_helper import start_docker_pg, stop_docker_pg
|
|
31
|
-
from ..
|
|
32
|
-
from .._sys_db import SystemDatabase, reset_system_database
|
|
31
|
+
from .._sys_db import SystemDatabase
|
|
33
32
|
from .._utils import GlobalParams
|
|
34
33
|
from ..cli._github_init import create_template_from_github
|
|
35
34
|
from ._template_init import copy_template, get_project_name, get_templates_directory
|
|
36
35
|
|
|
37
36
|
|
|
38
|
-
def _get_db_url(
|
|
37
|
+
def _get_db_url(
|
|
38
|
+
*, system_database_url: Optional[str], application_database_url: Optional[str]
|
|
39
|
+
) -> Tuple[str, str]:
|
|
39
40
|
"""
|
|
40
41
|
Get the database URL to use for the DBOS application.
|
|
41
42
|
Order of precedence:
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
- If the `
|
|
43
|
+
- In DBOS Cloud, use the environment variables provided.
|
|
44
|
+
- Use database URL arguments if provided.
|
|
45
|
+
- If the `dbos-config.yaml` file is present, use the database URLs from it.
|
|
45
46
|
|
|
46
|
-
Otherwise fallback to the same
|
|
47
|
+
Otherwise fallback to the same SQLite Postgres URL than the DBOS library.
|
|
47
48
|
Note that for the latter to be possible, a configuration file must have been found, with an application name set.
|
|
48
49
|
"""
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if os.environ.get("DBOS__CLOUD") == "true":
|
|
51
|
+
system_database_url = os.environ.get("DBOS_SYSTEM_DATABASE_URL")
|
|
52
|
+
application_database_url = os.environ.get("DBOS_DATABASE_URL")
|
|
53
|
+
assert system_database_url and application_database_url
|
|
54
|
+
return system_database_url, application_database_url
|
|
55
|
+
if system_database_url or application_database_url:
|
|
56
|
+
cfg: ConfigFile = {
|
|
57
|
+
"system_database_url": system_database_url,
|
|
58
|
+
"database_url": application_database_url,
|
|
59
|
+
}
|
|
60
|
+
return get_system_database_url(cfg), get_application_database_url(cfg)
|
|
61
|
+
else:
|
|
52
62
|
# Load from config file if present
|
|
53
63
|
try:
|
|
54
|
-
config = load_config(
|
|
55
|
-
database_url
|
|
56
|
-
|
|
64
|
+
config = load_config(silent=True)
|
|
65
|
+
if config.get("database_url") or config.get("system_database_url"):
|
|
66
|
+
return get_system_database_url(config), get_application_database_url(
|
|
67
|
+
config
|
|
68
|
+
)
|
|
69
|
+
else:
|
|
70
|
+
_app_db_name = _app_name_to_db_name(config["name"])
|
|
71
|
+
# Fallback on the same defaults than the DBOS library
|
|
72
|
+
default_url = f"sqlite:///{_app_db_name}.sqlite"
|
|
73
|
+
return default_url, default_url
|
|
57
74
|
except (FileNotFoundError, OSError):
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# Fallback on the same defaults than the DBOS library
|
|
64
|
-
_password = os.environ.get("PGPASSWORD", "dbos")
|
|
65
|
-
database_url = f"postgres://postgres:{_password}@localhost:5432/{_app_db_name}?connect_timeout=10&sslmode=prefer"
|
|
66
|
-
if database_url is None:
|
|
67
|
-
raise ValueError(
|
|
68
|
-
"Missing database URL: please set it using the --db-url flag, the DBOS_DATABASE_URL environment variable, or in your dbos-config.yaml file."
|
|
69
|
-
)
|
|
70
|
-
assert is_valid_database_url(database_url)
|
|
71
|
-
return database_url
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def start_client(db_url: Optional[str] = None) -> DBOSClient:
|
|
75
|
-
database_url = _get_db_url(db_url)
|
|
76
|
-
return DBOSClient(database_url=database_url)
|
|
75
|
+
typer.echo(
|
|
76
|
+
f"Error: Missing database URL: please set it using CLI flags or your dbos-config.yaml file.",
|
|
77
|
+
err=True,
|
|
78
|
+
)
|
|
79
|
+
raise typer.Exit(code=1)
|
|
77
80
|
|
|
78
81
|
|
|
79
82
|
app = typer.Typer()
|
|
@@ -115,7 +118,7 @@ def _on_windows() -> bool:
|
|
|
115
118
|
help="Start your DBOS application using the start commands in 'dbos-config.yaml'"
|
|
116
119
|
)
|
|
117
120
|
def start() -> None:
|
|
118
|
-
config = load_config(
|
|
121
|
+
config = load_config(silent=True)
|
|
119
122
|
start_commands = config["runtimeConfig"]["start"]
|
|
120
123
|
typer.echo("Executing start commands from 'dbos-config.yaml'")
|
|
121
124
|
for command in start_commands:
|
|
@@ -264,7 +267,7 @@ def _resolve_project_name_and_template(
|
|
|
264
267
|
|
|
265
268
|
@app.command(help="Create DBOS system tables.")
|
|
266
269
|
def migrate(
|
|
267
|
-
|
|
270
|
+
application_database_url: Annotated[
|
|
268
271
|
typing.Optional[str],
|
|
269
272
|
typer.Option(
|
|
270
273
|
"--db-url",
|
|
@@ -289,28 +292,25 @@ def migrate(
|
|
|
289
292
|
),
|
|
290
293
|
] = None,
|
|
291
294
|
) -> None:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
"system_database_url": system_database_url,
|
|
296
|
-
"database_url": app_database_url,
|
|
297
|
-
"database": {},
|
|
298
|
-
}
|
|
295
|
+
system_database_url, application_database_url = _get_db_url(
|
|
296
|
+
system_database_url=system_database_url,
|
|
297
|
+
application_database_url=application_database_url,
|
|
299
298
|
)
|
|
300
299
|
|
|
301
300
|
typer.echo(f"Starting DBOS migrations")
|
|
302
|
-
typer.echo(f"Application database: {sa.make_url(
|
|
301
|
+
typer.echo(f"Application database: {sa.make_url(application_database_url)}")
|
|
303
302
|
typer.echo(f"System database: {sa.make_url(system_database_url)}")
|
|
304
303
|
|
|
305
304
|
# First, run DBOS migrations on the system database and the application database
|
|
306
305
|
migrate_dbos_databases(
|
|
307
|
-
app_database_url=
|
|
306
|
+
app_database_url=application_database_url,
|
|
307
|
+
system_database_url=system_database_url,
|
|
308
308
|
)
|
|
309
309
|
|
|
310
310
|
# Next, assign permissions on the DBOS schema to the application role, if any
|
|
311
311
|
if application_role:
|
|
312
312
|
grant_dbos_schema_permissions(
|
|
313
|
-
database_url=
|
|
313
|
+
database_url=application_database_url, role_name=application_role
|
|
314
314
|
)
|
|
315
315
|
grant_dbos_schema_permissions(
|
|
316
316
|
database_url=system_database_url, role_name=application_role
|
|
@@ -318,7 +318,7 @@ def migrate(
|
|
|
318
318
|
|
|
319
319
|
# Next, run any custom migration commands specified in the configuration
|
|
320
320
|
if os.path.exists("dbos-config.yaml"):
|
|
321
|
-
config = load_config(
|
|
321
|
+
config = load_config(silent=True)
|
|
322
322
|
if "database" not in config:
|
|
323
323
|
config["database"] = {}
|
|
324
324
|
migrate_commands = (
|
|
@@ -346,20 +346,20 @@ def migrate(
|
|
|
346
346
|
@app.command(help="Reset the DBOS system database")
|
|
347
347
|
def reset(
|
|
348
348
|
yes: bool = typer.Option(False, "-y", "--yes", help="Skip confirmation prompt"),
|
|
349
|
-
|
|
349
|
+
application_database_url: Annotated[
|
|
350
350
|
typing.Optional[str],
|
|
351
351
|
typer.Option(
|
|
352
|
-
"--
|
|
353
|
-
"-
|
|
354
|
-
help="
|
|
352
|
+
"--db-url",
|
|
353
|
+
"-D",
|
|
354
|
+
help="Your DBOS application database URL",
|
|
355
355
|
),
|
|
356
356
|
] = None,
|
|
357
|
-
|
|
357
|
+
system_database_url: Annotated[
|
|
358
358
|
typing.Optional[str],
|
|
359
359
|
typer.Option(
|
|
360
|
-
"--db-url",
|
|
361
|
-
"-
|
|
362
|
-
help="Your DBOS
|
|
360
|
+
"--sys-db-url",
|
|
361
|
+
"-s",
|
|
362
|
+
help="Your DBOS system database URL",
|
|
363
363
|
),
|
|
364
364
|
] = None,
|
|
365
365
|
) -> None:
|
|
@@ -371,22 +371,12 @@ def reset(
|
|
|
371
371
|
typer.echo("Operation cancelled.")
|
|
372
372
|
raise typer.Exit()
|
|
373
373
|
try:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
assert (
|
|
378
|
-
pg_db_url.database is not None
|
|
379
|
-
), f"Database name is required in URL: {pg_db_url.render_as_string(hide_password=True)}"
|
|
380
|
-
# Resolve system database name
|
|
381
|
-
sysdb_name = (
|
|
382
|
-
sys_db_name
|
|
383
|
-
if sys_db_name
|
|
384
|
-
else (pg_db_url.database + SystemSchema.sysdb_suffix)
|
|
385
|
-
)
|
|
386
|
-
reset_system_database(
|
|
387
|
-
postgres_db_url=pg_db_url.set(database="postgres"), sysdb_name=sysdb_name
|
|
374
|
+
system_database_url, application_database_url = _get_db_url(
|
|
375
|
+
system_database_url=system_database_url,
|
|
376
|
+
application_database_url=application_database_url,
|
|
388
377
|
)
|
|
389
|
-
|
|
378
|
+
SystemDatabase.reset_system_database(system_database_url)
|
|
379
|
+
except Exception as e:
|
|
390
380
|
typer.echo(f"Error resetting system database: {str(e)}")
|
|
391
381
|
return
|
|
392
382
|
|
|
@@ -409,7 +399,7 @@ def debug(
|
|
|
409
399
|
|
|
410
400
|
@workflow.command(help="List workflows for your application")
|
|
411
401
|
def list(
|
|
412
|
-
|
|
402
|
+
application_database_url: Annotated[
|
|
413
403
|
typing.Optional[str],
|
|
414
404
|
typer.Option(
|
|
415
405
|
"--db-url",
|
|
@@ -417,6 +407,14 @@ def list(
|
|
|
417
407
|
help="Your DBOS application database URL",
|
|
418
408
|
),
|
|
419
409
|
] = None,
|
|
410
|
+
system_database_url: Annotated[
|
|
411
|
+
typing.Optional[str],
|
|
412
|
+
typer.Option(
|
|
413
|
+
"--sys-db-url",
|
|
414
|
+
"-s",
|
|
415
|
+
help="Your DBOS system database URL",
|
|
416
|
+
),
|
|
417
|
+
] = None,
|
|
420
418
|
limit: Annotated[
|
|
421
419
|
int,
|
|
422
420
|
typer.Option("--limit", "-l", help="Limit the results returned"),
|
|
@@ -429,7 +427,7 @@ def list(
|
|
|
429
427
|
typing.Optional[str],
|
|
430
428
|
typer.Option(
|
|
431
429
|
"--start-time",
|
|
432
|
-
"-
|
|
430
|
+
"-t",
|
|
433
431
|
help="Retrieve workflows starting after this timestamp (ISO 8601 format)",
|
|
434
432
|
),
|
|
435
433
|
] = None,
|
|
@@ -482,7 +480,15 @@ def list(
|
|
|
482
480
|
),
|
|
483
481
|
] = None,
|
|
484
482
|
) -> None:
|
|
485
|
-
|
|
483
|
+
system_database_url, application_database_url = _get_db_url(
|
|
484
|
+
system_database_url=system_database_url,
|
|
485
|
+
application_database_url=application_database_url,
|
|
486
|
+
)
|
|
487
|
+
client = DBOSClient(
|
|
488
|
+
application_database_url=application_database_url,
|
|
489
|
+
system_database_url=system_database_url,
|
|
490
|
+
)
|
|
491
|
+
workflows = client.list_workflows(
|
|
486
492
|
limit=limit,
|
|
487
493
|
offset=offset,
|
|
488
494
|
sort_desc=sort_desc,
|
|
@@ -499,7 +505,7 @@ def list(
|
|
|
499
505
|
@workflow.command(help="Retrieve the status of a workflow")
|
|
500
506
|
def get(
|
|
501
507
|
workflow_id: Annotated[str, typer.Argument()],
|
|
502
|
-
|
|
508
|
+
application_database_url: Annotated[
|
|
503
509
|
typing.Optional[str],
|
|
504
510
|
typer.Option(
|
|
505
511
|
"--db-url",
|
|
@@ -507,19 +513,31 @@ def get(
|
|
|
507
513
|
help="Your DBOS application database URL",
|
|
508
514
|
),
|
|
509
515
|
] = None,
|
|
516
|
+
system_database_url: Annotated[
|
|
517
|
+
typing.Optional[str],
|
|
518
|
+
typer.Option(
|
|
519
|
+
"--sys-db-url",
|
|
520
|
+
"-s",
|
|
521
|
+
help="Your DBOS system database URL",
|
|
522
|
+
),
|
|
523
|
+
] = None,
|
|
510
524
|
) -> None:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
525
|
+
system_database_url, application_database_url = _get_db_url(
|
|
526
|
+
system_database_url=system_database_url,
|
|
527
|
+
application_database_url=application_database_url,
|
|
528
|
+
)
|
|
529
|
+
client = DBOSClient(
|
|
530
|
+
application_database_url=application_database_url,
|
|
531
|
+
system_database_url=system_database_url,
|
|
515
532
|
)
|
|
533
|
+
status = client.retrieve_workflow(workflow_id=workflow_id).get_status()
|
|
516
534
|
print(jsonpickle.encode(status, unpicklable=False))
|
|
517
535
|
|
|
518
536
|
|
|
519
537
|
@workflow.command(help="List the steps of a workflow")
|
|
520
538
|
def steps(
|
|
521
539
|
workflow_id: Annotated[str, typer.Argument()],
|
|
522
|
-
|
|
540
|
+
application_database_url: Annotated[
|
|
523
541
|
typing.Optional[str],
|
|
524
542
|
typer.Option(
|
|
525
543
|
"--db-url",
|
|
@@ -527,10 +545,26 @@ def steps(
|
|
|
527
545
|
help="Your DBOS application database URL",
|
|
528
546
|
),
|
|
529
547
|
] = None,
|
|
548
|
+
system_database_url: Annotated[
|
|
549
|
+
typing.Optional[str],
|
|
550
|
+
typer.Option(
|
|
551
|
+
"--sys-db-url",
|
|
552
|
+
"-s",
|
|
553
|
+
help="Your DBOS system database URL",
|
|
554
|
+
),
|
|
555
|
+
] = None,
|
|
530
556
|
) -> None:
|
|
557
|
+
system_database_url, application_database_url = _get_db_url(
|
|
558
|
+
system_database_url=system_database_url,
|
|
559
|
+
application_database_url=application_database_url,
|
|
560
|
+
)
|
|
561
|
+
client = DBOSClient(
|
|
562
|
+
application_database_url=application_database_url,
|
|
563
|
+
system_database_url=system_database_url,
|
|
564
|
+
)
|
|
531
565
|
print(
|
|
532
566
|
jsonpickle.encode(
|
|
533
|
-
|
|
567
|
+
client.list_workflow_steps(workflow_id=workflow_id),
|
|
534
568
|
unpicklable=False,
|
|
535
569
|
)
|
|
536
570
|
)
|
|
@@ -541,7 +575,7 @@ def steps(
|
|
|
541
575
|
)
|
|
542
576
|
def cancel(
|
|
543
577
|
workflow_id: Annotated[str, typer.Argument()],
|
|
544
|
-
|
|
578
|
+
application_database_url: Annotated[
|
|
545
579
|
typing.Optional[str],
|
|
546
580
|
typer.Option(
|
|
547
581
|
"--db-url",
|
|
@@ -549,14 +583,30 @@ def cancel(
|
|
|
549
583
|
help="Your DBOS application database URL",
|
|
550
584
|
),
|
|
551
585
|
] = None,
|
|
586
|
+
system_database_url: Annotated[
|
|
587
|
+
typing.Optional[str],
|
|
588
|
+
typer.Option(
|
|
589
|
+
"--sys-db-url",
|
|
590
|
+
"-s",
|
|
591
|
+
help="Your DBOS system database URL",
|
|
592
|
+
),
|
|
593
|
+
] = None,
|
|
552
594
|
) -> None:
|
|
553
|
-
|
|
595
|
+
system_database_url, application_database_url = _get_db_url(
|
|
596
|
+
system_database_url=system_database_url,
|
|
597
|
+
application_database_url=application_database_url,
|
|
598
|
+
)
|
|
599
|
+
client = DBOSClient(
|
|
600
|
+
application_database_url=application_database_url,
|
|
601
|
+
system_database_url=system_database_url,
|
|
602
|
+
)
|
|
603
|
+
client.cancel_workflow(workflow_id=workflow_id)
|
|
554
604
|
|
|
555
605
|
|
|
556
606
|
@workflow.command(help="Resume a workflow that has been cancelled")
|
|
557
607
|
def resume(
|
|
558
608
|
workflow_id: Annotated[str, typer.Argument()],
|
|
559
|
-
|
|
609
|
+
application_database_url: Annotated[
|
|
560
610
|
typing.Optional[str],
|
|
561
611
|
typer.Option(
|
|
562
612
|
"--db-url",
|
|
@@ -564,8 +614,24 @@ def resume(
|
|
|
564
614
|
help="Your DBOS application database URL",
|
|
565
615
|
),
|
|
566
616
|
] = None,
|
|
617
|
+
system_database_url: Annotated[
|
|
618
|
+
typing.Optional[str],
|
|
619
|
+
typer.Option(
|
|
620
|
+
"--sys-db-url",
|
|
621
|
+
"-s",
|
|
622
|
+
help="Your DBOS system database URL",
|
|
623
|
+
),
|
|
624
|
+
] = None,
|
|
567
625
|
) -> None:
|
|
568
|
-
|
|
626
|
+
system_database_url, application_database_url = _get_db_url(
|
|
627
|
+
system_database_url=system_database_url,
|
|
628
|
+
application_database_url=application_database_url,
|
|
629
|
+
)
|
|
630
|
+
client = DBOSClient(
|
|
631
|
+
application_database_url=application_database_url,
|
|
632
|
+
system_database_url=system_database_url,
|
|
633
|
+
)
|
|
634
|
+
client.resume_workflow(workflow_id=workflow_id)
|
|
569
635
|
|
|
570
636
|
|
|
571
637
|
@workflow.command(
|
|
@@ -573,7 +639,7 @@ def resume(
|
|
|
573
639
|
)
|
|
574
640
|
def restart(
|
|
575
641
|
workflow_id: Annotated[str, typer.Argument()],
|
|
576
|
-
|
|
642
|
+
application_database_url: Annotated[
|
|
577
643
|
typing.Optional[str],
|
|
578
644
|
typer.Option(
|
|
579
645
|
"--db-url",
|
|
@@ -581,12 +647,24 @@ def restart(
|
|
|
581
647
|
help="Your DBOS application database URL",
|
|
582
648
|
),
|
|
583
649
|
] = None,
|
|
650
|
+
system_database_url: Annotated[
|
|
651
|
+
typing.Optional[str],
|
|
652
|
+
typer.Option(
|
|
653
|
+
"--sys-db-url",
|
|
654
|
+
"-s",
|
|
655
|
+
help="Your DBOS system database URL",
|
|
656
|
+
),
|
|
657
|
+
] = None,
|
|
584
658
|
) -> None:
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
.get_status()
|
|
659
|
+
system_database_url, application_database_url = _get_db_url(
|
|
660
|
+
system_database_url=system_database_url,
|
|
661
|
+
application_database_url=application_database_url,
|
|
589
662
|
)
|
|
663
|
+
client = DBOSClient(
|
|
664
|
+
application_database_url=application_database_url,
|
|
665
|
+
system_database_url=system_database_url,
|
|
666
|
+
)
|
|
667
|
+
status = client.fork_workflow(workflow_id=workflow_id, start_step=1).get_status()
|
|
590
668
|
print(jsonpickle.encode(status, unpicklable=False))
|
|
591
669
|
|
|
592
670
|
|
|
@@ -599,7 +677,7 @@ def fork(
|
|
|
599
677
|
int,
|
|
600
678
|
typer.Option(
|
|
601
679
|
"--step",
|
|
602
|
-
"-
|
|
680
|
+
"-S",
|
|
603
681
|
help="Restart from this step",
|
|
604
682
|
),
|
|
605
683
|
] = 1,
|
|
@@ -619,7 +697,7 @@ def fork(
|
|
|
619
697
|
help="Custom application version for the forked workflow",
|
|
620
698
|
),
|
|
621
699
|
] = None,
|
|
622
|
-
|
|
700
|
+
application_database_url: Annotated[
|
|
623
701
|
typing.Optional[str],
|
|
624
702
|
typer.Option(
|
|
625
703
|
"--db-url",
|
|
@@ -627,8 +705,23 @@ def fork(
|
|
|
627
705
|
help="Your DBOS application database URL",
|
|
628
706
|
),
|
|
629
707
|
] = None,
|
|
708
|
+
system_database_url: Annotated[
|
|
709
|
+
typing.Optional[str],
|
|
710
|
+
typer.Option(
|
|
711
|
+
"--sys-db-url",
|
|
712
|
+
"-s",
|
|
713
|
+
help="Your DBOS system database URL",
|
|
714
|
+
),
|
|
715
|
+
] = None,
|
|
630
716
|
) -> None:
|
|
631
|
-
|
|
717
|
+
system_database_url, application_database_url = _get_db_url(
|
|
718
|
+
system_database_url=system_database_url,
|
|
719
|
+
application_database_url=application_database_url,
|
|
720
|
+
)
|
|
721
|
+
client = DBOSClient(
|
|
722
|
+
application_database_url=application_database_url,
|
|
723
|
+
system_database_url=system_database_url,
|
|
724
|
+
)
|
|
632
725
|
|
|
633
726
|
if forked_workflow_id is not None:
|
|
634
727
|
with SetWorkflowID(forked_workflow_id):
|
|
@@ -648,7 +741,7 @@ def fork(
|
|
|
648
741
|
|
|
649
742
|
@queue.command(name="list", help="List enqueued functions for your application")
|
|
650
743
|
def list_queue(
|
|
651
|
-
|
|
744
|
+
application_database_url: Annotated[
|
|
652
745
|
typing.Optional[str],
|
|
653
746
|
typer.Option(
|
|
654
747
|
"--db-url",
|
|
@@ -656,6 +749,14 @@ def list_queue(
|
|
|
656
749
|
help="Your DBOS application database URL",
|
|
657
750
|
),
|
|
658
751
|
] = None,
|
|
752
|
+
system_database_url: Annotated[
|
|
753
|
+
typing.Optional[str],
|
|
754
|
+
typer.Option(
|
|
755
|
+
"--sys-db-url",
|
|
756
|
+
"-s",
|
|
757
|
+
help="Your DBOS system database URL",
|
|
758
|
+
),
|
|
759
|
+
] = None,
|
|
659
760
|
limit: Annotated[
|
|
660
761
|
typing.Optional[int],
|
|
661
762
|
typer.Option("--limit", "-l", help="Limit the results returned"),
|
|
@@ -664,7 +765,7 @@ def list_queue(
|
|
|
664
765
|
typing.Optional[str],
|
|
665
766
|
typer.Option(
|
|
666
767
|
"--start-time",
|
|
667
|
-
"-
|
|
768
|
+
"-t",
|
|
668
769
|
help="Retrieve functions starting after this timestamp (ISO 8601 format)",
|
|
669
770
|
),
|
|
670
771
|
] = None,
|
|
@@ -717,7 +818,15 @@ def list_queue(
|
|
|
717
818
|
),
|
|
718
819
|
] = None,
|
|
719
820
|
) -> None:
|
|
720
|
-
|
|
821
|
+
system_database_url, application_database_url = _get_db_url(
|
|
822
|
+
system_database_url=system_database_url,
|
|
823
|
+
application_database_url=application_database_url,
|
|
824
|
+
)
|
|
825
|
+
client = DBOSClient(
|
|
826
|
+
application_database_url=application_database_url,
|
|
827
|
+
system_database_url=system_database_url,
|
|
828
|
+
)
|
|
829
|
+
workflows = client.list_queued_workflows(
|
|
721
830
|
limit=limit,
|
|
722
831
|
offset=offset,
|
|
723
832
|
sort_desc=sort_desc,
|
dbos/cli/migration.py
CHANGED
|
@@ -9,7 +9,7 @@ def migrate_dbos_databases(app_database_url: str, system_database_url: str) -> N
|
|
|
9
9
|
app_db = None
|
|
10
10
|
sys_db = None
|
|
11
11
|
try:
|
|
12
|
-
sys_db = SystemDatabase(
|
|
12
|
+
sys_db = SystemDatabase.create(
|
|
13
13
|
system_database_url=system_database_url,
|
|
14
14
|
engine_kwargs={
|
|
15
15
|
"pool_timeout": 30,
|
|
@@ -17,7 +17,7 @@ def migrate_dbos_databases(app_database_url: str, system_database_url: str) -> N
|
|
|
17
17
|
"pool_size": 2,
|
|
18
18
|
},
|
|
19
19
|
)
|
|
20
|
-
app_db = ApplicationDatabase(
|
|
20
|
+
app_db = ApplicationDatabase.create(
|
|
21
21
|
database_url=app_database_url,
|
|
22
22
|
engine_kwargs={
|
|
23
23
|
"pool_timeout": 30,
|
dbos/dbos-config.schema.json
CHANGED
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"type": ["string", "null"],
|
|
20
20
|
"description": "The URL of the application database"
|
|
21
21
|
},
|
|
22
|
+
"system_database_url": {
|
|
23
|
+
"type": ["string", "null"],
|
|
24
|
+
"description": "The URL of the system database"
|
|
25
|
+
},
|
|
22
26
|
"database": {
|
|
23
27
|
"type": "object",
|
|
24
28
|
"additionalProperties": false,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
dbos-1.13.0.dist-info/METADATA,sha256=JWO5Y5s30Jmd8fEW-Jx1UUPbbIzXc-OWM04BcC5VGGk,13266
|
|
2
|
+
dbos-1.13.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
dbos-1.13.0.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
|
4
|
+
dbos-1.13.0.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
|
5
|
+
dbos/__init__.py,sha256=NssPCubaBxdiKarOWa-wViz1hdJSkmBGcpLX_gQ4NeA,891
|
|
6
|
+
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
|
7
|
+
dbos/_admin_server.py,sha256=e8ELhcDWqR3_PNobnNgUvLGh5lzZq0yFSF6dvtzoQRI,16267
|
|
8
|
+
dbos/_alembic_migrations/env.py,sha256=38SIGVbmn_VV2x2u1aHLcPOoWgZ84eCymf3g_NljmbU,1626
|
|
9
|
+
dbos/_alembic_migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
|
10
|
+
dbos/_alembic_migrations/versions/01ce9f07bd10_streaming.py,sha256=5F2tCCXbjP3ZrRFVBwJdaf4FHLlWuhQkMQiYmypfSNM,1123
|
|
11
|
+
dbos/_alembic_migrations/versions/04ca4f231047_workflow_queues_executor_id.py,sha256=ICLPl8CN9tQXMsLDsAj8z1TsL831-Z3F8jSBvrR-wyw,736
|
|
12
|
+
dbos/_alembic_migrations/versions/27ac6900c6ad_add_queue_dedup.py,sha256=56w1v6TdofW3V18iwm0MP0SAeSaAUPSS40HIcn6qYIE,1072
|
|
13
|
+
dbos/_alembic_migrations/versions/471b60d64126_dbos_migrations.py,sha256=XHlv_RFDoO3l3hjAVHm4uH2OA67e_BjQyW1D7HQqYLc,851
|
|
14
|
+
dbos/_alembic_migrations/versions/50f3227f0b4b_fix_job_queue.py,sha256=ZBYrtTdxy64HxIAlOes89fVIk2P1gNaJack7wuC_epg,873
|
|
15
|
+
dbos/_alembic_migrations/versions/5c361fc04708_added_system_tables.py,sha256=Xr9hBDJjkAtymlauOmAy00yUHj0VVUaEz7kNwEM9IwE,6403
|
|
16
|
+
dbos/_alembic_migrations/versions/66478e1b95e5_consolidate_queues.py,sha256=Qo9C8pFSdN0GPM0fN-DI5GPRegXq99Mig2me04IXfLI,1894
|
|
17
|
+
dbos/_alembic_migrations/versions/83f3732ae8e7_workflow_timeout.py,sha256=Q_R35pb8AfVI3sg5mzKwyoPfYB88Ychcc8gwxpM9R7A,1035
|
|
18
|
+
dbos/_alembic_migrations/versions/933e86bdac6a_add_queue_priority.py,sha256=yZX2kGF33skpXIBdMXtDNx-Nl_orFatKeHB8c-3K8-c,773
|
|
19
|
+
dbos/_alembic_migrations/versions/a3b18ad34abe_added_triggers.py,sha256=Rv0ZsZYZ_WdgGEULYsPfnp4YzaO5L198gDTgYY39AVA,2022
|
|
20
|
+
dbos/_alembic_migrations/versions/d76646551a6b_job_queue_limiter.py,sha256=8PyFi8rd6CN-mUro43wGhsg5wcQWKZPRHD6jw8R5pVc,986
|
|
21
|
+
dbos/_alembic_migrations/versions/d76646551a6c_workflow_queue.py,sha256=G942nophZ2uC2vc4hGBC02Ptng1715roTjY3xiyzZU4,729
|
|
22
|
+
dbos/_alembic_migrations/versions/d994145b47b6_consolidate_inputs.py,sha256=_J0jP247fuo66fzOmLlKFO9FJ_CRBXlqa2lnLrcXugQ,672
|
|
23
|
+
dbos/_alembic_migrations/versions/eab0cc1d9a14_job_queue.py,sha256=uvhFOtqbBreCePhAxZfIT0qCAI7BiZTou9wt6QnbY7c,1412
|
|
24
|
+
dbos/_alembic_migrations/versions/f4b9b32ba814_functionname_childid_op_outputs.py,sha256=m90Lc5YH0ZISSq1MyxND6oq3RZrZKrIqEsZtwJ1jWxA,1049
|
|
25
|
+
dbos/_app_db.py,sha256=GsV-uYU0QsChWwQDxnrh8_iiZ_zMQB-bsP2jPGIe2aM,16094
|
|
26
|
+
dbos/_classproperty.py,sha256=f0X-_BySzn3yFDRKB2JpCbLYQ9tLwt1XftfshvY7CBs,626
|
|
27
|
+
dbos/_client.py,sha256=n6Wk_8sG5qtqJw3vAkBTh4qsl7q_t6nnRukGjTJbwqg,18794
|
|
28
|
+
dbos/_conductor/conductor.py,sha256=3E_hL3c9g9yWqKZkvI6KA0-ZzPMPRo06TOzT1esMiek,24114
|
|
29
|
+
dbos/_conductor/protocol.py,sha256=q3rgLxINFtWFigdOONc-4gX4vn66UmMlJQD6Kj8LnL4,7420
|
|
30
|
+
dbos/_context.py,sha256=IMboNgbCqTxfIORqeifE3da-Ce5siMz7MYMLPk5M-AQ,26851
|
|
31
|
+
dbos/_core.py,sha256=2IWEkewiYL3d3MrhMfqj0JDWNyNM54rpW7CRGjBTPfk,48788
|
|
32
|
+
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
|
33
|
+
dbos/_dbos.py,sha256=wKLN7W1ej6cyEOHnCtt3-awnU6SR6MQAlOvTTt5_N-E,58219
|
|
34
|
+
dbos/_dbos_config.py,sha256=_26ktif8qAZW4Ujg6dZfLkYO7dE4CI8b3IQbw_5YkpA,25710
|
|
35
|
+
dbos/_debug.py,sha256=99j2SChWmCPAlZoDmjsJGe77tpU2LEa8E2TtLAnnh7o,1831
|
|
36
|
+
dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
|
|
37
|
+
dbos/_error.py,sha256=GwO0Ng4d4iB52brY09-Ss6Cz_V28Xc0D0cRCzZ6XmNM,8688
|
|
38
|
+
dbos/_event_loop.py,sha256=cvaFN9-II3MsHEOq8QoICc_8qSKrjikMlLfuhC3Y8Dk,2923
|
|
39
|
+
dbos/_fastapi.py,sha256=D0H6TPYYTJ0LnkKn7t9sfPwPgDx6fO8AZQtvBcH3ibI,3277
|
|
40
|
+
dbos/_flask.py,sha256=Npnakt-a3W5OykONFRkDRnumaDhTQmA0NPdUCGRYKXE,1652
|
|
41
|
+
dbos/_kafka.py,sha256=Gm4fHWl7gYb-i5BMvwNwm5Km3z8zQpseqdMgqgFjlGI,4252
|
|
42
|
+
dbos/_kafka_message.py,sha256=NYvOXNG3Qn7bghn1pv3fg4Pbs86ILZGcK4IB-MLUNu0,409
|
|
43
|
+
dbos/_logger.py,sha256=vvBL4kzJWBPtfcHIuL0nJAq5cgpeo_D3IiIUDicWLOg,4732
|
|
44
|
+
dbos/_migration.py,sha256=wJrSTYerlkYDFYmkTqo4a7n4WaKmqXh8BdkUEzgSEQQ,10898
|
|
45
|
+
dbos/_outcome.py,sha256=Kz3aL7517q9UEFTx3Cq9zzztjWyWVOx_08fZyHo9dvg,7035
|
|
46
|
+
dbos/_queue.py,sha256=0kJTPwXy3nZ4Epzt-lHky9M9S4L31645drPGFR8fIJY,4854
|
|
47
|
+
dbos/_recovery.py,sha256=K-wlFhdf4yGRm6cUzyhcTjQUS0xp2T5rdNMLiiBErYg,2882
|
|
48
|
+
dbos/_registrations.py,sha256=bEOntObnWaBylnebr5ZpcX2hk7OVLDd1z4BvW4_y3zA,7380
|
|
49
|
+
dbos/_roles.py,sha256=kCuhhg8XLtrHCgKgm44I0abIRTGHltf88OwjEKAUggk,2317
|
|
50
|
+
dbos/_scheduler.py,sha256=CWeGVfl9h51VXfxt80y5Da_5pE8SPty_AYkfpJkkMxQ,2117
|
|
51
|
+
dbos/_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
|
+
dbos/_schemas/application_database.py,sha256=SypAS9l9EsaBHFn9FR8jmnqt01M74d9AF1AMa4m2hhI,1040
|
|
53
|
+
dbos/_schemas/system_database.py,sha256=-dAKk-_Y3vzbpLT4ei-sIrBQgFyQiwPj1enZb1TYc8I,4943
|
|
54
|
+
dbos/_serialization.py,sha256=bWuwhXSQcGmiazvhJHA5gwhrRWxtmFmcCFQSDJnqqkU,3666
|
|
55
|
+
dbos/_sys_db.py,sha256=DhpthOe2hbG7Cp8CxJd5tRUyqgKJ7HWbgEySpt6GTwY,81756
|
|
56
|
+
dbos/_sys_db_postgres.py,sha256=WcG-f1CUzUNBGEOjqKEp6DDraN63jTnJ6CAfieCcxOs,7555
|
|
57
|
+
dbos/_sys_db_sqlite.py,sha256=xT9l-czMhLmfuu5UcnBzAyUxSFgzt3XtEWx9t_D8mZs,7361
|
|
58
|
+
dbos/_templates/dbos-db-starter/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
|
|
59
|
+
dbos/_templates/dbos-db-starter/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
|
+
dbos/_templates/dbos-db-starter/__package/main.py.dbos,sha256=aQnBPSSQpkB8ERfhf7gB7P9tsU6OPKhZscfeh0yiaD8,2702
|
|
61
|
+
dbos/_templates/dbos-db-starter/__package/schema.py,sha256=7Z27JGC8yy7Z44cbVXIREYxtUhU4JVkLCp5Q7UahVQ0,260
|
|
62
|
+
dbos/_templates/dbos-db-starter/alembic.ini,sha256=VKBn4Gy8mMuCdY7Hip1jmo3wEUJ1VG1aW7EqY0_n-as,3695
|
|
63
|
+
dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos,sha256=0wPktElM7kMB3OPHTXw4xBk9bgGKMqOHrrr7x_R23Z8,446
|
|
64
|
+
dbos/_templates/dbos-db-starter/migrations/env.py.dbos,sha256=IBB_gz9RjC20HPfOTGZzS6kTbv3jXhiOrnWpbJNk1Gk,2509
|
|
65
|
+
dbos/_templates/dbos-db-starter/migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
|
66
|
+
dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py,sha256=MpS7LGaJS0CpvsjhfDkp9EJqvMvVCjRPfUp4c0aE2ys,941
|
|
67
|
+
dbos/_templates/dbos-db-starter/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
|
|
68
|
+
dbos/_tracer.py,sha256=8aOAVTBnj2q9DcOb5KJCfo56CVZ1ZvsWBscaNlIX-7k,3150
|
|
69
|
+
dbos/_utils.py,sha256=ZdoM1MDbHnlJrh31zfhp3iX62bAxK1kyvMwXnltC_84,1779
|
|
70
|
+
dbos/_workflow_commands.py,sha256=EmmAaQfRWeOZm_WPTznuU-O3he3jiSzzT9VpYrhxugE,4835
|
|
71
|
+
dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
|
|
72
|
+
dbos/cli/_template_init.py,sha256=7JBcpMqP1r2mfCnvWatu33z8ctEGHJarlZYKgB83cXE,2972
|
|
73
|
+
dbos/cli/cli.py,sha256=ypaDSJq8HMDDiTsXqoxKw7B5n2wBT2ujjHjzkuh1AsY,26879
|
|
74
|
+
dbos/cli/migration.py,sha256=5GiyagLZkyVvDz3StYxtFdkFoKFCmh6eSXjzsIGhZ_A,3330
|
|
75
|
+
dbos/dbos-config.schema.json,sha256=LyUT1DOTaAwOP6suxQGS5KemVIqXGPyu_q7Hbo0neA8,6192
|
|
76
|
+
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
|
77
|
+
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
|
78
|
+
dbos-1.13.0.dist-info/RECORD,,
|