dbos 1.15.0a3__tar.gz → 1.15.0a4__tar.gz

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.
Files changed (100) hide show
  1. {dbos-1.15.0a3 → dbos-1.15.0a4}/PKG-INFO +1 -1
  2. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_admin_server.py +1 -1
  3. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_client.py +0 -2
  4. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_dbos.py +0 -24
  5. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_dbos_config.py +4 -18
  6. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/cli/cli.py +0 -42
  7. dbos-1.15.0a4/dbos/dbos-config.schema.json +61 -0
  8. {dbos-1.15.0a3 → dbos-1.15.0a4}/pyproject.toml +1 -1
  9. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_async_workflow_management.py +0 -19
  10. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_config.py +2 -52
  11. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_package.py +0 -11
  12. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_schema_migration.py +0 -25
  13. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_workflow_management.py +0 -56
  14. dbos-1.15.0a3/dbos/dbos-config.schema.json +0 -182
  15. {dbos-1.15.0a3 → dbos-1.15.0a4}/LICENSE +0 -0
  16. {dbos-1.15.0a3 → dbos-1.15.0a4}/README.md +0 -0
  17. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/__init__.py +0 -0
  18. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/__main__.py +0 -0
  19. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_app_db.py +0 -0
  20. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_classproperty.py +0 -0
  21. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_conductor/conductor.py +0 -0
  22. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_conductor/protocol.py +0 -0
  23. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_context.py +0 -0
  24. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_core.py +0 -0
  25. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_croniter.py +0 -0
  26. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_debouncer.py +0 -0
  27. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_debug.py +0 -0
  28. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_docker_pg_helper.py +0 -0
  29. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_error.py +0 -0
  30. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_event_loop.py +0 -0
  31. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_fastapi.py +0 -0
  32. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_flask.py +0 -0
  33. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_kafka.py +0 -0
  34. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_kafka_message.py +0 -0
  35. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_logger.py +0 -0
  36. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_migration.py +0 -0
  37. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_outcome.py +0 -0
  38. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_queue.py +0 -0
  39. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_recovery.py +0 -0
  40. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_registrations.py +0 -0
  41. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_roles.py +0 -0
  42. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_scheduler.py +0 -0
  43. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_schemas/__init__.py +0 -0
  44. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_schemas/application_database.py +0 -0
  45. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_schemas/system_database.py +0 -0
  46. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_serialization.py +0 -0
  47. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_sys_db.py +0 -0
  48. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_sys_db_postgres.py +0 -0
  49. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_sys_db_sqlite.py +0 -0
  50. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/README.md +0 -0
  51. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/__package/__init__.py +0 -0
  52. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/__package/main.py.dbos +0 -0
  53. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/__package/schema.py +0 -0
  54. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos +0 -0
  55. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/migrations/create_table.py.dbos +0 -0
  56. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_templates/dbos-db-starter/start_postgres_docker.py +0 -0
  57. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_tracer.py +0 -0
  58. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_utils.py +0 -0
  59. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/_workflow_commands.py +0 -0
  60. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/cli/_github_init.py +0 -0
  61. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/cli/_template_init.py +0 -0
  62. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/cli/migration.py +0 -0
  63. {dbos-1.15.0a3 → dbos-1.15.0a4}/dbos/py.typed +0 -0
  64. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/__init__.py +0 -0
  65. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/atexit_no_ctor.py +0 -0
  66. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/atexit_no_launch.py +0 -0
  67. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/classdefs.py +0 -0
  68. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/client_collateral.py +0 -0
  69. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/client_worker.py +0 -0
  70. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/conftest.py +0 -0
  71. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/dupname_classdefs1.py +0 -0
  72. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/dupname_classdefsa.py +0 -0
  73. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/more_classdefs.py +0 -0
  74. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/queuedworkflow.py +0 -0
  75. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/script_without_fastapi.py +0 -0
  76. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_admin_server.py +0 -0
  77. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_async.py +0 -0
  78. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_classdecorators.py +0 -0
  79. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_cli.py +0 -0
  80. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_client.py +0 -0
  81. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_concurrency.py +0 -0
  82. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_croniter.py +0 -0
  83. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_dbos.py +0 -0
  84. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_debouncer.py +0 -0
  85. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_debug.py +0 -0
  86. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_docker_secrets.py +0 -0
  87. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_failures.py +0 -0
  88. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_fastapi.py +0 -0
  89. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_fastapi_roles.py +0 -0
  90. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_flask.py +0 -0
  91. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_kafka.py +0 -0
  92. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_outcome.py +0 -0
  93. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_queue.py +0 -0
  94. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_scheduler.py +0 -0
  95. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_singleton.py +0 -0
  96. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_spans.py +0 -0
  97. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_sqlalchemy.py +0 -0
  98. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_streaming.py +0 -0
  99. {dbos-1.15.0a3 → dbos-1.15.0a4}/tests/test_workflow_introspection.py +0 -0
  100. {dbos-1.15.0a3 → dbos-1.15.0a4}/version/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 1.15.0a3
3
+ Version: 1.15.0a4
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -244,7 +244,7 @@ class AdminRequestHandler(BaseHTTPRequestHandler):
244
244
  def _handle_restart(self, workflow_id: str) -> None:
245
245
  try:
246
246
  print(f"Restarting workflow {workflow_id}")
247
- handle = self.dbos.restart_workflow(workflow_id)
247
+ handle = self.dbos.fork_workflow(workflow_id, 1)
248
248
  response_body = json.dumps(
249
249
  {
250
250
  "workflow_id": handle.workflow_id,
@@ -124,7 +124,6 @@ class DBOSClient:
124
124
  system_database_url: Optional[str] = None,
125
125
  application_database_url: Optional[str] = None,
126
126
  dbos_system_schema: Optional[str] = "dbos",
127
- system_database: Optional[str] = None, # DEPRECATED
128
127
  ):
129
128
  application_database_url = (
130
129
  database_url if database_url else application_database_url
@@ -133,7 +132,6 @@ class DBOSClient:
133
132
  {
134
133
  "system_database_url": system_database_url,
135
134
  "database_url": application_database_url,
136
- "database": {"sys_db_name": system_database},
137
135
  }
138
136
  )
139
137
  assert is_valid_database_url(system_database_url)
@@ -1029,16 +1029,6 @@ class DBOS:
1029
1029
  await asyncio.to_thread(cls.resume_workflow, workflow_id)
1030
1030
  return await cls.retrieve_workflow_async(workflow_id)
1031
1031
 
1032
- @classmethod
1033
- def restart_workflow(cls, workflow_id: str) -> WorkflowHandle[Any]:
1034
- """Restart a workflow with a new workflow ID"""
1035
- return cls.fork_workflow(workflow_id, 1)
1036
-
1037
- @classmethod
1038
- async def restart_workflow_async(cls, workflow_id: str) -> WorkflowHandleAsync[Any]:
1039
- """Restart a workflow with a new workflow ID"""
1040
- return await cls.fork_workflow_async(workflow_id, 1)
1041
-
1042
1032
  @classmethod
1043
1033
  def fork_workflow(
1044
1034
  cls,
@@ -1274,20 +1264,6 @@ class DBOS:
1274
1264
  else:
1275
1265
  return None
1276
1266
 
1277
- @classproperty
1278
- def parent_workflow_id(cls) -> str:
1279
- """
1280
- This method is deprecated and should not be used.
1281
- """
1282
- dbos_logger.warning(
1283
- "DBOS.parent_workflow_id is deprecated and should not be used"
1284
- )
1285
- ctx = assert_current_dbos_context()
1286
- assert (
1287
- ctx.is_within_workflow()
1288
- ), "parent_workflow_id is only available within a workflow."
1289
- return ctx.parent_workflow_id
1290
-
1291
1267
  @classproperty
1292
1268
  def span(cls) -> "Span":
1293
1269
  """Return the tracing `Span` associated with the current context."""
@@ -22,7 +22,6 @@ class DBOSConfig(TypedDict, total=False):
22
22
  system_database_url (str): Connection string for the DBOS system database. Defaults to sqlite:///{name} if not provided.
23
23
  application_database_url (str): Connection string for the DBOS application database, in which DBOS @Transaction functions run. Optional. Should be the same type of database (SQLite or Postgres) as the system database.
24
24
  database_url (str): (DEPRECATED) Database connection string
25
- sys_db_name (str): (DEPRECATED) System database name
26
25
  sys_db_pool_size (int): System database pool size
27
26
  db_engine_kwargs (Dict[str, Any]): SQLAlchemy engine kwargs (See https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine)
28
27
  log_level (str): Log level
@@ -41,7 +40,6 @@ class DBOSConfig(TypedDict, total=False):
41
40
  system_database_url: Optional[str]
42
41
  application_database_url: Optional[str]
43
42
  database_url: Optional[str]
44
- sys_db_name: Optional[str]
45
43
  sys_db_pool_size: Optional[int]
46
44
  db_engine_kwargs: Optional[Dict[str, Any]]
47
45
  log_level: Optional[str]
@@ -74,14 +72,10 @@ class DatabaseConfig(TypedDict, total=False):
74
72
  dbos_system_schema (str): Schema name for DBOS system tables. Defaults to "dbos".
75
73
  """
76
74
 
77
- sys_db_name: Optional[str]
78
- sys_db_pool_size: Optional[
79
- int
80
- ] # For internal use, will be removed in a future version
75
+ sys_db_pool_size: Optional[int]
81
76
  db_engine_kwargs: Optional[Dict[str, Any]]
82
77
  sys_db_engine_kwargs: Optional[Dict[str, Any]]
83
78
  migrate: Optional[List[str]]
84
- rollback: Optional[List[str]] # Will be removed in a future version
85
79
 
86
80
 
87
81
  class OTLPExporterConfig(TypedDict, total=False):
@@ -139,8 +133,6 @@ def translate_dbos_config_to_config_file(config: DBOSConfig) -> ConfigFile:
139
133
 
140
134
  # Database config
141
135
  db_config: DatabaseConfig = {}
142
- if "sys_db_name" in config:
143
- db_config["sys_db_name"] = config.get("sys_db_name")
144
136
  if "sys_db_pool_size" in config:
145
137
  db_config["sys_db_pool_size"] = config.get("sys_db_pool_size")
146
138
  if "db_engine_kwargs" in config:
@@ -409,10 +401,7 @@ def process_config(
409
401
  else:
410
402
  url = make_url(data["database_url"])
411
403
  assert url.database
412
- if data["database"].get("sys_db_name"):
413
- url = url.set(database=data["database"]["sys_db_name"])
414
- else:
415
- url = url.set(database=f"{url.database}{SystemSchema.sysdb_suffix}")
404
+ url = url.set(database=f"{url.database}{SystemSchema.sysdb_suffix}")
416
405
  data["system_database_url"] = url.render_as_string(hide_password=False)
417
406
 
418
407
  # If a system database URL is provided but not an application database URL,
@@ -617,11 +606,8 @@ def get_system_database_url(config: ConfigFile) -> str:
617
606
  if config["database_url"].startswith("sqlite"):
618
607
  return config["database_url"]
619
608
  app_db_url = make_url(config["database_url"])
620
- if config.get("database") and config["database"].get("sys_db_name") is not None:
621
- sys_db_name = config["database"]["sys_db_name"]
622
- else:
623
- assert app_db_url.database is not None
624
- sys_db_name = app_db_url.database + SystemSchema.sysdb_suffix
609
+ assert app_db_url.database is not None
610
+ sys_db_name = app_db_url.database + SystemSchema.sysdb_suffix
625
611
  return app_db_url.set(database=sys_db_name).render_as_string(
626
612
  hide_password=False
627
613
  )
@@ -681,48 +681,6 @@ def resume(
681
681
  client.resume_workflow(workflow_id=workflow_id)
682
682
 
683
683
 
684
- @workflow.command(
685
- help="[DEPRECATED - Use fork instead] Restart a workflow from the beginning with a new id"
686
- )
687
- def restart(
688
- workflow_id: Annotated[str, typer.Argument()],
689
- application_database_url: Annotated[
690
- typing.Optional[str],
691
- typer.Option(
692
- "--db-url",
693
- "-D",
694
- help="Your DBOS application database URL",
695
- ),
696
- ] = None,
697
- system_database_url: Annotated[
698
- typing.Optional[str],
699
- typer.Option(
700
- "--sys-db-url",
701
- "-s",
702
- help="Your DBOS system database URL",
703
- ),
704
- ] = None,
705
- schema: Annotated[
706
- typing.Optional[str],
707
- typer.Option(
708
- "--schema",
709
- help='Schema name for DBOS system tables. Defaults to "dbos".',
710
- ),
711
- ] = "dbos",
712
- ) -> None:
713
- system_database_url, application_database_url = _get_db_url(
714
- system_database_url=system_database_url,
715
- application_database_url=application_database_url,
716
- )
717
- client = DBOSClient(
718
- application_database_url=application_database_url,
719
- system_database_url=system_database_url,
720
- dbos_system_schema=schema,
721
- )
722
- status = client.fork_workflow(workflow_id=workflow_id, start_step=1).get_status()
723
- print(json.dumps(status.__dict__, cls=DefaultEncoder))
724
-
725
-
726
684
  @workflow.command(
727
685
  help="fork a workflow from the beginning with a new id and from a step"
728
686
  )
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "DBOS Config",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The name of your application"
10
+ },
11
+ "language": {
12
+ "type": "string",
13
+ "description": "The language used in your application",
14
+ "enum": [
15
+ "python"
16
+ ]
17
+ },
18
+ "database_url": {
19
+ "type": ["string", "null"],
20
+ "description": "The URL of the application database"
21
+ },
22
+ "system_database_url": {
23
+ "type": ["string", "null"],
24
+ "description": "The URL of the system database"
25
+ },
26
+ "database": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "properties": {
30
+ "app_db_name": {
31
+ "type": ["string", "null"],
32
+ "description": "The name of the application database in DBOS Cloud",
33
+ "deprecated": true
34
+ },
35
+ "migrate": {
36
+ "type": "array",
37
+ "description": "Specify a list of user database migration commands to run in DBOS Cloud"
38
+ }
39
+ }
40
+ },
41
+ "runtimeConfig": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "start": {
46
+ "type": "array",
47
+ "description": "Specify commands to run to start your application in DBOS Cloud"
48
+ },
49
+ "setup": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ },
54
+ "description": "Commands to setup the application execution environment in DBOS Cloud"
55
+ }
56
+ }
57
+ },
58
+ "env": {}
59
+ }
60
+ }
61
+
@@ -15,7 +15,7 @@ dependencies = [
15
15
  ]
16
16
  requires-python = ">=3.10"
17
17
  readme = "README.md"
18
- version = "1.15.0a3"
18
+ version = "1.15.0a4"
19
19
 
20
20
  [project.license]
21
21
  text = "MIT"
@@ -95,25 +95,6 @@ async def test_resume_workflow_async(dbos: DBOS) -> None:
95
95
  assert steps_completed == 2
96
96
 
97
97
 
98
- @pytest.mark.asyncio
99
- async def test_restart_workflow_async(dbos: DBOS) -> None:
100
- """Test async restart_workflow method."""
101
- input_val = 2
102
- multiplier = 5
103
-
104
- @DBOS.workflow()
105
- def simple_workflow(x: int) -> int:
106
- return x * multiplier
107
-
108
- # Start the workflow, let it finish, restart it async
109
- handle = DBOS.start_workflow(simple_workflow, input_val)
110
- assert handle.get_result() == input_val * multiplier
111
-
112
- forked_handle = await DBOS.restart_workflow_async(handle.workflow_id)
113
- assert forked_handle.workflow_id != handle.workflow_id
114
- assert (await forked_handle.get_result()) == input_val * multiplier
115
-
116
-
117
98
  @pytest.mark.asyncio
118
99
  async def test_fork_workflow_async(dbos: DBOS) -> None:
119
100
  """Test async fork_workflow method."""
@@ -168,7 +168,6 @@ def test_process_config_full():
168
168
  "name": "some-app",
169
169
  "database_url": "postgres://user:password@localhost:7777/dbn?connect_timeout=1&sslmode=require&sslrootcert=ca.pem",
170
170
  "database": {
171
- "sys_db_name": "sys_db",
172
171
  "sys_db_pool_size": 27,
173
172
  "db_engine_kwargs": {"key": "value"},
174
173
  "migrate": ["alembic upgrade head"],
@@ -199,10 +198,9 @@ def test_process_config_full():
199
198
  configFile["database_url"]
200
199
  == "postgres://user:password@localhost:7777/dbn?connect_timeout=1&sslmode=require&sslrootcert=ca.pem"
201
200
  )
202
- assert configFile["database"]["sys_db_name"] == "sys_db"
203
201
  assert (
204
202
  configFile["system_database_url"]
205
- == f"postgres://user:password@localhost:7777/{config['database']['sys_db_name']}?connect_timeout=1&sslmode=require&sslrootcert=ca.pem"
203
+ == f"postgres://user:password@localhost:7777/dbn_dbos_sys?connect_timeout=1&sslmode=require&sslrootcert=ca.pem"
206
204
  )
207
205
  assert configFile["database"]["migrate"] == ["alembic upgrade head"]
208
206
  assert configFile["database"]["db_engine_kwargs"] == {
@@ -241,7 +239,6 @@ def test_process_config_system_database():
241
239
  "database_url": "postgres://user:password@localhost:7777/dbn?connect_timeout=1&sslmode=require&sslrootcert=ca.pem",
242
240
  "system_database_url": "postgres://user:password@localhost:7778/dbn_sys?connect_timeout=1&sslmode=require&sslrootcert=ca.pem",
243
241
  "database": {
244
- "sys_db_name": "sys_db",
245
242
  "sys_db_pool_size": 27,
246
243
  "db_engine_kwargs": {"key": "value"},
247
244
  "migrate": ["alembic upgrade head"],
@@ -386,24 +383,6 @@ def test_config_bad_name():
386
383
  assert "Invalid app name" in str(exc_info.value)
387
384
 
388
385
 
389
- def test_config_mixed_params():
390
- config = {
391
- "name": "some-app",
392
- "database": {
393
- "sys_db_name": "yoohoo",
394
- },
395
- }
396
-
397
- configFile = process_config(data=config)
398
- assert configFile["name"] == "some-app"
399
- assert configFile["database_url"] is None
400
- assert configFile["system_database_url"] == f"sqlite:///some_app.sqlite"
401
- assert configFile["database"]["db_engine_kwargs"] is not None
402
- assert configFile["database"]["sys_db_engine_kwargs"] is not None
403
- assert configFile["telemetry"]["logs"]["logLevel"] == "INFO"
404
- assert configFile["runtimeConfig"]["run_admin_server"] == True
405
-
406
-
407
386
  ####################
408
387
  # PROCESS DB ENGINE KWARGS
409
388
  ####################
@@ -682,7 +661,6 @@ def test_translate_dbosconfig_full_input():
682
661
  config: DBOSConfig = {
683
662
  "name": "test-app",
684
663
  "database_url": "postgres://user:password@localhost:5432/dbname?connect_timeout=11&sslmode=require&sslrootcert=ca.pem",
685
- "sys_db_name": "sysdb",
686
664
  "sys_db_pool_size": 27,
687
665
  "db_engine_kwargs": {"key": "value"},
688
666
  "log_level": "DEBUG",
@@ -696,7 +674,6 @@ def test_translate_dbosconfig_full_input():
696
674
 
697
675
  assert translated_config["name"] == "test-app"
698
676
  assert translated_config["database_url"] == config["database_url"]
699
- assert translated_config["database"]["sys_db_name"] == "sysdb"
700
677
  assert translated_config["database"]["sys_db_pool_size"] == 27
701
678
  assert translated_config["database"]["db_engine_kwargs"] == {"key": "value"}
702
679
  assert translated_config["telemetry"]["logs"]["logLevel"] == "DEBUG"
@@ -728,19 +705,6 @@ def test_translate_dbosconfig_minimal_input():
728
705
  assert "env" not in translated_config
729
706
 
730
707
 
731
- def test_translate_dbosconfig_just_sys_db_name():
732
- config: DBOSConfig = {
733
- "name": "test-app",
734
- "sys_db_name": "sysdb",
735
- }
736
- translated_config = translate_dbos_config_to_config_file(config)
737
-
738
- assert translated_config["database"]["sys_db_name"] == "sysdb"
739
- assert "sys_db_pool_size" not in translated_config["database"]
740
- assert "env" not in translated_config
741
- assert "admin_port" not in translated_config["runtimeConfig"]
742
-
743
-
744
708
  def test_translate_dbosconfig_just_sys_db_pool_size():
745
709
  config: DBOSConfig = {
746
710
  "name": "test-app",
@@ -749,7 +713,6 @@ def test_translate_dbosconfig_just_sys_db_pool_size():
749
713
  translated_config = translate_dbos_config_to_config_file(config)
750
714
 
751
715
  assert translated_config["database"]["sys_db_pool_size"] == 27
752
- assert "sys_db_name" not in translated_config["database"]
753
716
  assert "env" not in translated_config
754
717
 
755
718
 
@@ -762,7 +725,6 @@ def test_translate_dbosconfig_just_db_engine_kwargs():
762
725
 
763
726
  assert translated_config["database"]["db_engine_kwargs"] == {"key": "value"}
764
727
  assert "sys_db_pool_size" not in translated_config["database"]
765
- assert "sys_db_name" not in translated_config["database"]
766
728
  assert "env" not in translated_config
767
729
  assert "admin_port" not in translated_config["runtimeConfig"]
768
730
 
@@ -851,7 +813,6 @@ def test_overwrite_config(mocker):
851
813
  name: "stock-prices"
852
814
  language: "python"
853
815
  database:
854
- sys_db_name: sysdbname
855
816
  migrate:
856
817
  - alembic upgrade head
857
818
  telemetry:
@@ -870,9 +831,7 @@ def test_overwrite_config(mocker):
870
831
 
871
832
  provided_config: ConfigFile = {
872
833
  "name": "test-app",
873
- "database": {
874
- "sys_db_name": "sysdb",
875
- },
834
+ "database": {},
876
835
  "telemetry": {
877
836
  "OTLPExporter": {
878
837
  "tracesEndpoint": ["a"],
@@ -924,7 +883,6 @@ def test_overwrite_config_minimal(mocker):
924
883
  name: "stock-prices"
925
884
  language: "python"
926
885
  database:
927
- sys_db_name: sysdbname
928
886
  migrate:
929
887
  - alembic upgrade head
930
888
  telemetry:
@@ -973,7 +931,6 @@ def test_overwrite_config_has_telemetry(mocker):
973
931
  name: "stock-prices"
974
932
  language: "python"
975
933
  database:
976
- sys_db_name: sysdbname
977
934
  migrate:
978
935
  - alembic upgrade head
979
936
  telemetry:
@@ -1022,8 +979,6 @@ def test_overwrite_config_no_telemetry_in_file(mocker):
1022
979
  mock_config = """
1023
980
  name: "stock-prices"
1024
981
  language: "python"
1025
- database:
1026
- sys_db_name: sysdbname
1027
982
  """
1028
983
  mocker.patch(
1029
984
  "builtins.open", side_effect=generate_mock_open("dbos-config.yaml", mock_config)
@@ -1058,8 +1013,6 @@ def test_overwrite_config_no_otlp_in_file(mocker):
1058
1013
  mock_config = """
1059
1014
  name: "stock-prices"
1060
1015
  language: "python"
1061
- database:
1062
- sys_db_name: sysdbname
1063
1016
  telemetry:
1064
1017
  logs:
1065
1018
  logLevel: INFO
@@ -1100,7 +1053,6 @@ def test_overwrite_config_with_provided_database_url(mocker):
1100
1053
  name: "stock-prices"
1101
1054
  language: "python"
1102
1055
  database:
1103
- sys_db_name: sysdbname
1104
1056
  migrate:
1105
1057
  - alembic upgrade head
1106
1058
  telemetry:
@@ -1146,8 +1098,6 @@ def test_overwrite_config_with_provided_database_url(mocker):
1146
1098
  def test_overwrite_config_missing_dbos_database_url(mocker):
1147
1099
  mock_config = """
1148
1100
  name: "stock-prices"
1149
- database:
1150
- sys_db_name: "sysdbname"
1151
1101
  """
1152
1102
 
1153
1103
  mocker.patch(
@@ -320,17 +320,6 @@ def test_workflow_commands(config: DBOSConfig) -> None:
320
320
  assert isinstance(get_wf_data, dict)
321
321
  assert get_wf_data["status"] == "ENQUEUED"
322
322
 
323
- # restart the workflow and check it has a new ID and its status is ENQUEUED
324
- output = subprocess.check_output(
325
- ["dbos", "workflow", "restart", wf_id, "--schema", schema],
326
- cwd=temp_path,
327
- env=env,
328
- )
329
- restart_wf_data = json.loads(output)
330
- assert isinstance(restart_wf_data, dict)
331
- assert restart_wf_data["workflow_id"] != wf_id
332
- assert restart_wf_data["status"] == "ENQUEUED"
333
-
334
323
  # fork the workflow at step 5 and check it has a new ID and its status is ENQUEUED
335
324
  output = subprocess.check_output(
336
325
  ["dbos", "workflow", "fork", wf_id, "--step", "5", "--schema", schema],
@@ -81,31 +81,6 @@ def test_systemdb_migration_custom_schema(
81
81
  DBOS.destroy()
82
82
 
83
83
 
84
- def test_custom_sysdb_name_migration(
85
- config: DBOSConfig, db_engine: sa.Engine, skip_with_sqlite: None
86
- ) -> None:
87
- sysdb_name = "custom_sysdb_name"
88
- config["sys_db_name"] = sysdb_name
89
-
90
- # Clean up from previous runs
91
- with db_engine.connect() as connection:
92
- connection.execution_options(isolation_level="AUTOCOMMIT")
93
- connection.execute(sa.text(f"DROP DATABASE IF EXISTS {sysdb_name}"))
94
-
95
- # Test migrating up
96
- DBOS.destroy() # In case of other tests leaving it
97
- dbos = DBOS(config=config)
98
- DBOS.launch()
99
-
100
- # Make sure all tables exist
101
- with dbos._sys_db.engine.connect() as connection:
102
- sql = SystemSchema.workflow_status.select()
103
- result = connection.execute(sql)
104
- assert result.fetchall() == []
105
-
106
- DBOS.destroy()
107
-
108
-
109
84
  def test_reset(
110
85
  config: DBOSConfig, db_engine: sa.Engine, skip_with_sqlite: None
111
86
  ) -> None:
@@ -170,62 +170,6 @@ def test_cancel_resume_queue(dbos: DBOS) -> None:
170
170
  assert queue_entries_are_cleaned_up(dbos)
171
171
 
172
172
 
173
- def test_restart(dbos: DBOS) -> None:
174
- input = 2
175
- multiplier = 5
176
-
177
- @DBOS.dbos_class()
178
- class TestClass(DBOSConfiguredInstance):
179
-
180
- def __init__(self, multiplier: int) -> None:
181
- self.multiply: Callable[[int], int] = lambda x: x * multiplier
182
- super().__init__("test_class")
183
-
184
- @DBOS.workflow()
185
- def workflow(self, x: int) -> int:
186
- return self.multiply(x)
187
-
188
- @DBOS.step()
189
- def step(self, x: int) -> int:
190
- return self.multiply(x)
191
-
192
- inst = TestClass(multiplier)
193
-
194
- # Start the workflow, let it finish, restart it.
195
- # Verify it returns the same result with a different workflow ID.
196
- handle = DBOS.start_workflow(inst.workflow, input)
197
- assert handle.get_result() == input * multiplier
198
- forked_handle = DBOS.restart_workflow(handle.workflow_id)
199
- assert forked_handle.workflow_id != handle.workflow_id
200
- assert forked_handle.get_result() == input * multiplier
201
-
202
- # Enqueue the workflow, let it finish, restart it.
203
- # Verify it returns the same result with a different workflow ID and queue.
204
- queue = Queue("test_queue")
205
- handle = queue.enqueue(inst.workflow, input)
206
- assert handle.get_result() == input * multiplier
207
- forked_handle = DBOS.restart_workflow(handle.workflow_id)
208
- assert forked_handle.workflow_id != handle.workflow_id
209
- assert forked_handle.get_status().queue_name == INTERNAL_QUEUE_NAME
210
- assert forked_handle.get_result() == input * multiplier
211
-
212
- # Enqueue the step, let it finish, restart it.
213
- # Verify it returns the same result with a different workflow ID and queue.
214
- handle = queue.enqueue(inst.step, input)
215
- assert handle.get_result() == input * multiplier
216
- forked_handle = DBOS.restart_workflow(handle.workflow_id)
217
- assert forked_handle.workflow_id != handle.workflow_id
218
- assert forked_handle.get_status().queue_name != handle.get_status().queue_name
219
- assert forked_handle.get_result() == input * multiplier
220
-
221
- # Verify restarting a nonexistent workflow throws an exception
222
- with pytest.raises(Exception):
223
- DBOS.restart_workflow("fake_id")
224
-
225
- # Verify nothing is left on any queue
226
- assert queue_entries_are_cleaned_up(dbos)
227
-
228
-
229
173
  def test_fork_steps(
230
174
  dbos: DBOS,
231
175
  ) -> None:
@@ -1,182 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "title": "DBOS Config",
4
- "type": "object",
5
- "additionalProperties": false,
6
- "properties": {
7
- "name": {
8
- "type": "string",
9
- "description": "The name of your application"
10
- },
11
- "language": {
12
- "type": "string",
13
- "description": "The language used in your application",
14
- "enum": [
15
- "python"
16
- ]
17
- },
18
- "database_url": {
19
- "type": ["string", "null"],
20
- "description": "The URL of the application database"
21
- },
22
- "system_database_url": {
23
- "type": ["string", "null"],
24
- "description": "The URL of the system database"
25
- },
26
- "database": {
27
- "type": "object",
28
- "additionalProperties": false,
29
- "properties": {
30
- "hostname": {
31
- "type": ["string", "null"],
32
- "description": "The hostname or IP address of the application database. DEPRECATED: Use database_url instead",
33
- "deprecated": true
34
- },
35
- "port": {
36
- "type": ["number", "null"],
37
- "description": "The port number of the application database. DEPRECATED: Use database_url instead",
38
- "deprecated": true
39
- },
40
- "username": {
41
- "type": ["string", "null"],
42
- "description": "The username to use when connecting to the application database. DEPRECATED: Use database_url instead",
43
- "not": {
44
- "enum": ["dbos"]
45
- },
46
- "deprecated": true
47
- },
48
- "password": {
49
- "type": ["string", "null"],
50
- "description": "The password to use when connecting to the application database. Developers are strongly encouraged to use environment variable substitution (${VAR_NAME}) or Docker secrets (${DOCKER_SECRET:SECRET_NAME}) to avoid storing secrets in source. DEPRECATED: Use database_url instead",
51
- "deprecated": true
52
- },
53
- "connectionTimeoutMillis": {
54
- "type": ["number", "null"],
55
- "description": "The number of milliseconds the system waits before timing out when connecting to the application database. DEPRECATED: Use database_url instead",
56
- "deprecated": true
57
- },
58
- "app_db_name": {
59
- "type": ["string", "null"],
60
- "description": "The name of the application database. DEPRECATED: Use database_url instead",
61
- "deprecated": true
62
- },
63
- "sys_db_name": {
64
- "type": "string",
65
- "description": "The name of the system database"
66
- },
67
- "ssl": {
68
- "type": ["boolean", "null"],
69
- "description": "Use SSL/TLS to securely connect to the database (default: true). DEPRECATED: Use database_url instead",
70
- "deprecated": true
71
- },
72
- "ssl_ca": {
73
- "type": ["string", "null"],
74
- "description": "If using SSL/TLS to securely connect to a database, path to an SSL root certificate file. DEPRECATED: Use database_url instead",
75
- "deprecated": true
76
- },
77
- "migrate": {
78
- "type": "array",
79
- "description": "Specify a list of user DB migration commands to run"
80
- },
81
- "rollback": {
82
- "type": "array",
83
- "description": "Specify a list of user DB rollback commands to run. DEPRECATED",
84
- "deprecated": true
85
- }
86
- }
87
- },
88
- "telemetry": {
89
- "type": "object",
90
- "additionalProperties": false,
91
- "properties": {
92
- "logs": {
93
- "type": "object",
94
- "additionalProperties": false,
95
- "properties": {
96
- "addContextMetadata": {
97
- "type": "boolean",
98
- "description": "Adds contextual information, such as workflow UUID, to each log entry"
99
- },
100
- "logLevel": {
101
- "type": "string",
102
- "description": "A filter on what logs should be printed to the standard output"
103
- },
104
- "silent": {
105
- "type": "boolean",
106
- "description": "Silences the logger such that nothing is printed to the standard output"
107
- }
108
- }
109
- },
110
- "OTLPExporter": {
111
- "type": "object",
112
- "additionalProperties": false,
113
- "properties": {
114
- "logsEndpoint": {
115
- "type": "string",
116
- "description": "The URL of an OTLP collector to which to export logs"
117
- },
118
- "tracesEndpoint": {
119
- "type": "string",
120
- "description": "The URL of an OTLP collector to which to export traces"
121
- }
122
- }
123
- }
124
- }
125
- },
126
- "runtimeConfig": {
127
- "type": "object",
128
- "additionalProperties": false,
129
- "properties": {
130
- "entrypoints": {
131
- "type": "array",
132
- "items": {
133
- "type": "string"
134
- }
135
- },
136
- "port": {
137
- "type": "number"
138
- },
139
- "start": {
140
- "type": "array",
141
- "description": "Specify commands to run to start your application (Python only)"
142
- },
143
- "setup": {
144
- "type": "array",
145
- "items": {
146
- "type": "string"
147
- },
148
- "description": "Commands to setup the application execution environment"
149
- },
150
- "admin_port": {
151
- "type": "number",
152
- "description": "The port number of the admin server (Default: 3001)"
153
- }
154
- }
155
- },
156
- "http": {
157
- "type": "object",
158
- "additionalProperties": false,
159
- "properties": {
160
- "cors_middleware": {
161
- "type": "boolean"
162
- },
163
- "credentials": {
164
- "type": "boolean"
165
- },
166
- "allowed_origins": {
167
- "type": "array",
168
- "items": {
169
- "type": "string"
170
- }
171
- }
172
- }
173
- },
174
- "application": {},
175
- "env": {},
176
- "version": {
177
- "type": "string",
178
- "deprecated": true
179
- }
180
- }
181
- }
182
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes