dbos 1.2.0a6__py3-none-any.whl → 1.2.0a9__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.
- dbos/_client.py +2 -2
- dbos/_dbos.py +0 -2
- dbos/_dbos_config.py +20 -16
- dbos/cli/cli.py +2 -1
- {dbos-1.2.0a6.dist-info → dbos-1.2.0a9.dist-info}/METADATA +1 -1
- {dbos-1.2.0a6.dist-info → dbos-1.2.0a9.dist-info}/RECORD +9 -9
- {dbos-1.2.0a6.dist-info → dbos-1.2.0a9.dist-info}/WHEEL +0 -0
- {dbos-1.2.0a6.dist-info → dbos-1.2.0a9.dist-info}/entry_points.txt +0 -0
- {dbos-1.2.0a6.dist-info → dbos-1.2.0a9.dist-info}/licenses/LICENSE +0 -0
dbos/_client.py
CHANGED
@@ -3,8 +3,6 @@ import sys
|
|
3
3
|
import uuid
|
4
4
|
from typing import Any, Generic, List, Optional, TypedDict, TypeVar
|
5
5
|
|
6
|
-
from sqlalchemy import URL
|
7
|
-
|
8
6
|
from dbos._app_db import ApplicationDatabase
|
9
7
|
from dbos._context import MaxPriority, MinPriority
|
10
8
|
|
@@ -15,6 +13,7 @@ else:
|
|
15
13
|
|
16
14
|
from dbos import _serialization
|
17
15
|
from dbos._dbos import WorkflowHandle, WorkflowHandleAsync
|
16
|
+
from dbos._dbos_config import is_valid_database_url
|
18
17
|
from dbos._error import DBOSException, DBOSNonExistentWorkflowError
|
19
18
|
from dbos._registrations import DEFAULT_MAX_RECOVERY_ATTEMPTS
|
20
19
|
from dbos._serialization import WorkflowInputs
|
@@ -99,6 +98,7 @@ class WorkflowHandleClientAsyncPolling(Generic[R]):
|
|
99
98
|
|
100
99
|
class DBOSClient:
|
101
100
|
def __init__(self, database_url: str, *, system_database: Optional[str] = None):
|
101
|
+
assert is_valid_database_url(database_url)
|
102
102
|
# We only create database connections but do not run migrations
|
103
103
|
self._sys_db = SystemDatabase(
|
104
104
|
database_url=database_url,
|
dbos/_dbos.py
CHANGED
@@ -92,7 +92,6 @@ from ._dbos_config import (
|
|
92
92
|
DBOSConfig,
|
93
93
|
overwrite_config,
|
94
94
|
process_config,
|
95
|
-
set_env_vars,
|
96
95
|
translate_dbos_config_to_config_file,
|
97
96
|
)
|
98
97
|
from ._error import (
|
@@ -329,7 +328,6 @@ class DBOS:
|
|
329
328
|
else:
|
330
329
|
raise ValueError("No valid configuration was loaded.")
|
331
330
|
|
332
|
-
set_env_vars(self._config)
|
333
331
|
config_logger(self._config)
|
334
332
|
dbos_tracer.config(self._config)
|
335
333
|
dbos_logger.info(f"Initializing DBOS (v{GlobalParams.dbos_version})")
|
dbos/_dbos_config.py
CHANGED
@@ -329,17 +329,9 @@ def process_config(
|
|
329
329
|
if data.get("database_url") is not None and data["database_url"] != "":
|
330
330
|
# Parse the db string and check required fields
|
331
331
|
assert data["database_url"] is not None
|
332
|
+
assert is_valid_database_url(data["database_url"])
|
333
|
+
|
332
334
|
url = make_url(data["database_url"])
|
333
|
-
required_fields = [
|
334
|
-
("username", "Username must be specified in the connection URL"),
|
335
|
-
("password", "Password must be specified in the connection URL"),
|
336
|
-
("host", "Host must be specified in the connection URL"),
|
337
|
-
("database", "Database name must be specified in the connection URL"),
|
338
|
-
]
|
339
|
-
for field_name, error_message in required_fields:
|
340
|
-
field_value = getattr(url, field_name, None)
|
341
|
-
if not field_value:
|
342
|
-
raise DBOSInitializationError(error_message)
|
343
335
|
|
344
336
|
if not data["database"].get("sys_db_name"):
|
345
337
|
assert url.database is not None
|
@@ -385,6 +377,9 @@ def process_config(
|
|
385
377
|
if not silent and logs["logLevel"] == "INFO" or logs["logLevel"] == "DEBUG":
|
386
378
|
log_url = make_url(data["database_url"]).render_as_string(hide_password=True)
|
387
379
|
print(f"[bold blue]Using database connection string: {log_url}[/bold blue]")
|
380
|
+
print(
|
381
|
+
f"[bold blue]Database engine parameters: {data['database']['db_engine_kwargs']}[/bold blue]"
|
382
|
+
)
|
388
383
|
|
389
384
|
# Return data as ConfigFile type
|
390
385
|
return data
|
@@ -432,6 +427,21 @@ def configure_db_engine_parameters(
|
|
432
427
|
data["sys_db_engine_kwargs"] = system_engine_kwargs
|
433
428
|
|
434
429
|
|
430
|
+
def is_valid_database_url(database_url: str) -> bool:
|
431
|
+
url = make_url(database_url)
|
432
|
+
required_fields = [
|
433
|
+
("username", "Username must be specified in the connection URL"),
|
434
|
+
("password", "Password must be specified in the connection URL"),
|
435
|
+
("host", "Host must be specified in the connection URL"),
|
436
|
+
("database", "Database name must be specified in the connection URL"),
|
437
|
+
]
|
438
|
+
for field_name, error_message in required_fields:
|
439
|
+
field_value = getattr(url, field_name, None)
|
440
|
+
if not field_value:
|
441
|
+
raise DBOSInitializationError(error_message)
|
442
|
+
return True
|
443
|
+
|
444
|
+
|
435
445
|
def _is_valid_app_name(name: str) -> bool:
|
436
446
|
name_len = len(name)
|
437
447
|
if name_len < 3 or name_len > 30:
|
@@ -445,12 +455,6 @@ def _app_name_to_db_name(app_name: str) -> str:
|
|
445
455
|
return name if not name[0].isdigit() else f"_{name}"
|
446
456
|
|
447
457
|
|
448
|
-
def set_env_vars(config: ConfigFile) -> None:
|
449
|
-
for env, value in config.get("env", {}).items():
|
450
|
-
if value is not None:
|
451
|
-
os.environ[env] = str(value)
|
452
|
-
|
453
|
-
|
454
458
|
def overwrite_config(provided_config: ConfigFile) -> ConfigFile:
|
455
459
|
# Load the DBOS configuration file and force the use of:
|
456
460
|
# 1. The database url provided by DBOS_DATABASE_URL
|
dbos/cli/cli.py
CHANGED
@@ -18,7 +18,7 @@ from dbos._debug import debug_workflow, parse_start_command
|
|
18
18
|
|
19
19
|
from .._app_db import ApplicationDatabase
|
20
20
|
from .._client import DBOSClient
|
21
|
-
from .._dbos_config import _is_valid_app_name, load_config
|
21
|
+
from .._dbos_config import _is_valid_app_name, is_valid_database_url, load_config
|
22
22
|
from .._docker_pg_helper import start_docker_pg, stop_docker_pg
|
23
23
|
from .._schemas.system_database import SystemSchema
|
24
24
|
from .._sys_db import SystemDatabase, reset_system_database
|
@@ -35,6 +35,7 @@ def _get_db_url(db_url: Optional[str]) -> str:
|
|
35
35
|
raise ValueError(
|
36
36
|
"Missing database URL: please set it using the --db-url flag or the DBOS_DATABASE_URL environment variable."
|
37
37
|
)
|
38
|
+
assert is_valid_database_url(database_url)
|
38
39
|
return database_url
|
39
40
|
|
40
41
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
dbos-1.2.
|
2
|
-
dbos-1.2.
|
3
|
-
dbos-1.2.
|
4
|
-
dbos-1.2.
|
1
|
+
dbos-1.2.0a9.dist-info/METADATA,sha256=ubEiLiylZ-mD87L2o3PiuuBvrO2dmgVy3N4Y8-_pvp8,13267
|
2
|
+
dbos-1.2.0a9.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
dbos-1.2.0a9.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-1.2.0a9.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=TWXi4drrzKFpKkUmEJpJkQBZxAtOalnhtYicEn2nDK0,10618
|
8
8
|
dbos/_app_db.py,sha256=0PKqpxJ3EbIaak3Wl0lNl3hXvhBfz4EEHaCw1bUOvIM,9937
|
9
9
|
dbos/_classproperty.py,sha256=f0X-_BySzn3yFDRKB2JpCbLYQ9tLwt1XftfshvY7CBs,626
|
10
|
-
dbos/_client.py,sha256=
|
10
|
+
dbos/_client.py,sha256=BZ5mROMnHrWyMsMj8gYCfey79Zc4eZp1Srlrgel485o,14302
|
11
11
|
dbos/_conductor/conductor.py,sha256=o0IaZjwnZ2TOyHeP2H4iSX6UnXLXQ4uODvWAKD9hHMs,21703
|
12
12
|
dbos/_conductor/protocol.py,sha256=wgOFZxmS81bv0WCB9dAyg0s6QzldpzVKQDoSPeaX0Ws,6967
|
13
13
|
dbos/_context.py,sha256=5ajoWAmToAfzzmMLylnJZoL4Ny9rBwZWuG05sXadMIA,24798
|
14
14
|
dbos/_core.py,sha256=m2i9lsHjNKTi8BQyiSOUBrAVH5OvMoBswNZPRpMVIC0,48662
|
15
15
|
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
16
|
-
dbos/_dbos.py,sha256=
|
17
|
-
dbos/_dbos_config.py,sha256=
|
16
|
+
dbos/_dbos.py,sha256=tby_y__7jWQ7O2j2Ws9W_7QKq25IrV54cvWgiPuZngU,47216
|
17
|
+
dbos/_dbos_config.py,sha256=JWVuPE_Ifyr-pYHFxclFalB_HZ8ETFCGNJzBHGpClXw,20347
|
18
18
|
dbos/_debug.py,sha256=MNlQVZ6TscGCRQeEEL0VE8Uignvr6dPeDDDefS3xgIE,1823
|
19
19
|
dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
|
20
20
|
dbos/_error.py,sha256=q0OQJZTbR8FFHV9hEpAGpz9oWBT5L509zUhmyff7FJw,8500
|
@@ -63,8 +63,8 @@ dbos/_utils.py,sha256=uywq1QrjMwy17btjxW4bES49povlQwYwYbvKwMT6C2U,1575
|
|
63
63
|
dbos/_workflow_commands.py,sha256=UCpHWvCEXjVZtf5FNanFvtJpgUJDSI1EFBqQP0x_2A0,3346
|
64
64
|
dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
|
65
65
|
dbos/cli/_template_init.py,sha256=7JBcpMqP1r2mfCnvWatu33z8ctEGHJarlZYKgB83cXE,2972
|
66
|
-
dbos/cli/cli.py,sha256=
|
66
|
+
dbos/cli/cli.py,sha256=EemOMqNpzSU2BQhAxV_e59pBRITDLwt49HF6W3uWBZg,20775
|
67
67
|
dbos/dbos-config.schema.json,sha256=CjaspeYmOkx6Ip_pcxtmfXJTn_YGdSx_0pcPBF7KZmo,6060
|
68
68
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
69
69
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
70
|
-
dbos-1.2.
|
70
|
+
dbos-1.2.0a9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|