dbos 1.9.0a4__py3-none-any.whl → 1.10.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/_dbos.py CHANGED
@@ -324,6 +324,17 @@ class DBOS:
324
324
  self.conductor_websocket: Optional[ConductorWebsocket] = None
325
325
  self._background_event_loop: BackgroundEventLoop = BackgroundEventLoop()
326
326
 
327
+ # Globally set the application version and executor ID.
328
+ # In DBOS Cloud, instead use the values supplied through environment variables.
329
+ if not os.environ.get("DBOS__CLOUD") == "true":
330
+ if (
331
+ "application_version" in config
332
+ and config["application_version"] is not None
333
+ ):
334
+ GlobalParams.app_version = config["application_version"]
335
+ if "executor_id" in config and config["executor_id"] is not None:
336
+ GlobalParams.executor_id = config["executor_id"]
337
+
327
338
  init_logger()
328
339
 
329
340
  # Translate user provided config to an internal format
dbos/_dbos_config.py CHANGED
@@ -47,6 +47,8 @@ class DBOSConfig(TypedDict, total=False):
47
47
  admin_port: Optional[int]
48
48
  run_admin_server: Optional[bool]
49
49
  otlp_attributes: Optional[dict[str, str]]
50
+ application_version: Optional[str]
51
+ executor_id: Optional[str]
50
52
 
51
53
 
52
54
  class RuntimeConfig(TypedDict, total=False):
dbos/cli/cli.py CHANGED
@@ -260,11 +260,9 @@ def _resolve_project_name_and_template(
260
260
  return project_name, template
261
261
 
262
262
 
263
- @app.command(
264
- help="Run your database schema migrations using the migration commands in 'dbos-config.yaml'"
265
- )
263
+ @app.command(help="Create DBOS system tables.")
266
264
  def migrate(
267
- db_url: Annotated[
265
+ app_database_url: Annotated[
268
266
  typing.Optional[str],
269
267
  typer.Option(
270
268
  "--db-url",
@@ -272,30 +270,34 @@ def migrate(
272
270
  help="Your DBOS application database URL",
273
271
  ),
274
272
  ] = None,
275
- sys_db_name: Annotated[
273
+ system_database_url: Annotated[
276
274
  typing.Optional[str],
277
275
  typer.Option(
278
- "--sys-db-name",
276
+ "--sys-db-url",
279
277
  "-s",
280
- help="Specify the name of the system database to reset",
278
+ help="Your DBOS system database URL",
281
279
  ),
282
280
  ] = None,
283
281
  ) -> None:
284
- config = load_config(run_process_config=False, silent=True)
285
- connection_string = _get_db_url(db_url)
286
- app_db_name = sa.make_url(connection_string).database
287
- assert app_db_name is not None, "Database name is required in URL"
288
- if sys_db_name is None:
289
- sys_db_name = app_db_name + SystemSchema.sysdb_suffix
282
+ app_database_url = _get_db_url(app_database_url)
283
+ system_database_url = get_system_database_url(
284
+ {
285
+ "system_database_url": system_database_url,
286
+ "database_url": app_database_url,
287
+ "database": {},
288
+ }
289
+ )
290
290
 
291
- typer.echo(f"Starting schema migration for database {app_db_name}")
291
+ typer.echo(f"Starting DBOS migrations")
292
+ typer.echo(f"Application database: {sa.make_url(app_database_url)}")
293
+ typer.echo(f"System database: {sa.make_url(system_database_url)}")
292
294
 
293
295
  # First, run DBOS migrations on the system database and the application database
294
296
  app_db = None
295
297
  sys_db = None
296
298
  try:
297
299
  sys_db = SystemDatabase(
298
- system_database_url=get_system_database_url(config),
300
+ system_database_url=system_database_url,
299
301
  engine_kwargs={
300
302
  "pool_timeout": 30,
301
303
  "max_overflow": 0,
@@ -303,7 +305,7 @@ def migrate(
303
305
  },
304
306
  )
305
307
  app_db = ApplicationDatabase(
306
- database_url=connection_string,
308
+ database_url=app_database_url,
307
309
  engine_kwargs={
308
310
  "pool_timeout": 30,
309
311
  "max_overflow": 0,
@@ -313,17 +315,19 @@ def migrate(
313
315
  sys_db.run_migrations()
314
316
  app_db.run_migrations()
315
317
  except Exception as e:
316
- typer.echo(f"DBOS system schema migration failed: {e}")
318
+ typer.echo(f"DBOS migrations failed: {e}")
319
+ raise typer.Exit(code=1)
317
320
  finally:
318
321
  if sys_db:
319
322
  sys_db.destroy()
320
323
  if app_db:
321
324
  app_db.destroy()
322
325
 
326
+ typer.echo(f"DBOS migrations successful")
327
+
323
328
  # Next, run any custom migration commands specified in the configuration
324
- typer.echo("Executing migration commands from 'dbos-config.yaml'")
325
- try:
326
- # handle the case where the user has not specified migrations commands
329
+ if os.path.exists("dbos-config.yaml"):
330
+ config = load_config(run_process_config=False, silent=True)
327
331
  if "database" not in config:
328
332
  config["database"] = {}
329
333
  migrate_commands = (
@@ -331,20 +335,21 @@ def migrate(
331
335
  if "migrate" in config["database"] and config["database"]["migrate"]
332
336
  else []
333
337
  )
334
- for command in migrate_commands:
335
- typer.echo(f"Executing migration command: {command}")
336
- result = subprocess.run(command, shell=True, text=True)
337
- if result.returncode != 0:
338
- typer.echo(f"Migration command failed: {command}")
339
- typer.echo(result.stderr)
340
- raise typer.Exit(1)
341
- if result.stdout:
342
- typer.echo(result.stdout.rstrip())
343
- except Exception as e:
344
- typer.echo(f"An error occurred during schema migration: {e}")
345
- raise typer.Exit(code=1)
346
-
347
- typer.echo(f"Completed schema migration for database {app_db_name}")
338
+ if migrate_commands:
339
+ typer.echo("Executing migration commands from 'dbos-config.yaml'")
340
+ try:
341
+ for command in migrate_commands:
342
+ typer.echo(f"Executing migration command: {command}")
343
+ result = subprocess.run(command, shell=True, text=True)
344
+ if result.returncode != 0:
345
+ typer.echo(f"Migration command failed: {command}")
346
+ typer.echo(result.stderr)
347
+ raise typer.Exit(1)
348
+ if result.stdout:
349
+ typer.echo(result.stdout.rstrip())
350
+ except Exception as e:
351
+ typer.echo(f"An error occurred during schema migration: {e}")
352
+ raise typer.Exit(code=1)
348
353
 
349
354
 
350
355
  @app.command(help="Reset the DBOS system database")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 1.9.0a4
3
+ Version: 1.10.0
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- dbos-1.9.0a4.dist-info/METADATA,sha256=10p1rBp6hwmtwGzPg6jwMbpVV9Ay9aCP37J8vdnCXtc,13267
2
- dbos-1.9.0a4.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- dbos-1.9.0a4.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-1.9.0a4.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-1.10.0.dist-info/METADATA,sha256=-pserGJ_dwh59IcFRCDiWgUH6TjoRXDGrhkEK4FIegY,13266
2
+ dbos-1.10.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ dbos-1.10.0.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-1.10.0.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=NssPCubaBxdiKarOWa-wViz1hdJSkmBGcpLX_gQ4NeA,891
6
6
  dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
7
7
  dbos/_admin_server.py,sha256=e8ELhcDWqR3_PNobnNgUvLGh5lzZq0yFSF6dvtzoQRI,16267
@@ -13,8 +13,8 @@ dbos/_conductor/protocol.py,sha256=q3rgLxINFtWFigdOONc-4gX4vn66UmMlJQD6Kj8LnL4,7
13
13
  dbos/_context.py,sha256=0vFtLAk3WF5BQYIYNFImDRBppKO2CTKOSy51zQC-Cu8,25723
14
14
  dbos/_core.py,sha256=TA-UOSO_BhvM6L6j4__dwesK7x5Y93dk6mV1xx0WZBY,49593
15
15
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
16
- dbos/_dbos.py,sha256=LqE8ej317diZ5JjrXhndLwDr40E1Aw3SK1YPxC8-t3k,50902
17
- dbos/_dbos_config.py,sha256=TWIbGCWl_8o3l0Y2IzrL1q9mTYl_vVeZDjYJMDXCPVU,21676
16
+ dbos/_dbos.py,sha256=0CDsUKvqfoX6i2Q74khU1hvJVpfy2tcGpQIDtEtWCAM,51469
17
+ dbos/_dbos_config.py,sha256=er8oF3e9zGlEG9KntX7uBSXrDuVvROtkzVidzXjOwUU,21746
18
18
  dbos/_debug.py,sha256=99j2SChWmCPAlZoDmjsJGe77tpU2LEa8E2TtLAnnh7o,1831
19
19
  dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
20
20
  dbos/_error.py,sha256=2_2ve3qN0BLhFWMmd3aD9At54tIMCeh8TqHtVcEEVQo,8705
@@ -65,8 +65,8 @@ dbos/_utils.py,sha256=uywq1QrjMwy17btjxW4bES49povlQwYwYbvKwMT6C2U,1575
65
65
  dbos/_workflow_commands.py,sha256=EmmAaQfRWeOZm_WPTznuU-O3he3jiSzzT9VpYrhxugE,4835
66
66
  dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
67
67
  dbos/cli/_template_init.py,sha256=7JBcpMqP1r2mfCnvWatu33z8ctEGHJarlZYKgB83cXE,2972
68
- dbos/cli/cli.py,sha256=oU2uvRF90eAydQ9FoQcgi8N_Cojzz8NLn1WE-vrA1p0,22155
68
+ dbos/cli/cli.py,sha256=BaWqdMZbUsJkq0zEaS2Ez2FgRgD5nTD24hCsrAlitbA,22289
69
69
  dbos/dbos-config.schema.json,sha256=CjaspeYmOkx6Ip_pcxtmfXJTn_YGdSx_0pcPBF7KZmo,6060
70
70
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
71
71
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
72
- dbos-1.9.0a4.dist-info/RECORD,,
72
+ dbos-1.10.0.dist-info/RECORD,,
File without changes