dbos 0.6.0a3__tar.gz → 0.6.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.
Potentially problematic release.
This version of dbos might be problematic. Click here for more details.
- {dbos-0.6.0a3 → dbos-0.6.0a4}/PKG-INFO +1 -1
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/dbos.py +8 -6
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/dbos_config.py +2 -1
- {dbos-0.6.0a3 → dbos-0.6.0a4}/pyproject.toml +1 -1
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/classdefs.py +1 -1
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_classdecorators.py +6 -6
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_singleton.py +12 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/LICENSE +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/README.md +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/__init__.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/admin_sever.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/application_database.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/cli.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/context.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/core.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/dbos-config.schema.json +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/decorators.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/error.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/fastapi.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/flask.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/logger.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/migrations/env.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/migrations/script.py.mako +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/migrations/versions/5c361fc04708_added_system_tables.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/py.typed +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/recovery.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/registrations.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/request.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/roles.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/scheduler/croniter.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/scheduler/scheduler.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/schemas/__init__.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/schemas/application_database.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/schemas/system_database.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/system_database.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/README.md +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/__package/__init__.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/__package/main.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/__package/schema.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/alembic.ini +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/dbos-config.yaml.dbos +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/migrations/env.py.dbos +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/migrations/script.py.mako +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/start_postgres_docker.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/tracer.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/utils.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/__init__.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/atexit_no_ctor.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/atexit_no_launch.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/conftest.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/more_classdefs.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/scheduler/test_croniter.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/scheduler/test_scheduler.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_admin_server.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_concurrency.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_config.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_dbos.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_failures.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_fastapi.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_fastapi_roles.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_flask.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_package.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/tests/test_schema_migration.py +0 -0
- {dbos-0.6.0a3 → dbos-0.6.0a4}/version/__init__.py +0 -0
|
@@ -714,6 +714,12 @@ class DBOS:
|
|
|
714
714
|
ctx = assert_current_dbos_context()
|
|
715
715
|
return ctx.authenticated_roles
|
|
716
716
|
|
|
717
|
+
@classproperty
|
|
718
|
+
def assumed_role(cls) -> Optional[str]:
|
|
719
|
+
"""Return the role currently assumed by the authenticated user, if any, associated with the current context."""
|
|
720
|
+
ctx = assert_current_dbos_context()
|
|
721
|
+
return ctx.assumed_role
|
|
722
|
+
|
|
717
723
|
@classmethod
|
|
718
724
|
def set_authentication(
|
|
719
725
|
cls, authenticated_user: Optional[str], authenticated_roles: Optional[List[str]]
|
|
@@ -800,13 +806,9 @@ class DBOSConfiguredInstance:
|
|
|
800
806
|
|
|
801
807
|
"""
|
|
802
808
|
|
|
803
|
-
def __init__(self, config_name: str
|
|
809
|
+
def __init__(self, config_name: str) -> None:
|
|
804
810
|
self.config_name = config_name
|
|
805
|
-
|
|
806
|
-
assert isinstance(dbos, DBOS)
|
|
807
|
-
dbos._registry.register_instance(self)
|
|
808
|
-
else:
|
|
809
|
-
DBOS.register_instance(self)
|
|
811
|
+
DBOS.register_instance(self)
|
|
810
812
|
|
|
811
813
|
|
|
812
814
|
# Apps that import DBOS probably don't exit. If they do, let's see if
|
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
4
|
from importlib import resources
|
|
5
|
-
from typing import Dict, List, Optional, TypedDict
|
|
5
|
+
from typing import Any, Dict, List, Optional, TypedDict
|
|
6
6
|
|
|
7
7
|
import yaml
|
|
8
8
|
from jsonschema import ValidationError, validate
|
|
@@ -69,6 +69,7 @@ class ConfigFile(TypedDict, total=False):
|
|
|
69
69
|
database: DatabaseConfig
|
|
70
70
|
telemetry: Optional[TelemetryConfig]
|
|
71
71
|
env: Dict[str, str]
|
|
72
|
+
application: Dict[str, Any]
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
def substitute_env_vars(content: str) -> str:
|
|
@@ -61,7 +61,7 @@ class DBOSTestClass(DBOSConfiguredInstance):
|
|
|
61
61
|
@DBOS.workflow()
|
|
62
62
|
@DBOS.required_roles(["admin"])
|
|
63
63
|
def test_func_admin(self, var: str) -> str:
|
|
64
|
-
assert
|
|
64
|
+
assert DBOS.assumed_role == "admin"
|
|
65
65
|
return self.config_name + ":" + var
|
|
66
66
|
|
|
67
67
|
|
|
@@ -49,7 +49,7 @@ def test_required_roles_class(dbos: DBOS) -> None:
|
|
|
49
49
|
@DBOS.default_required_roles(["user"])
|
|
50
50
|
class DBOSTestClassRR(DBOSConfiguredInstance):
|
|
51
51
|
def __init__(self) -> None:
|
|
52
|
-
super().__init__("myconfig"
|
|
52
|
+
super().__init__("myconfig")
|
|
53
53
|
|
|
54
54
|
@DBOS.workflow()
|
|
55
55
|
def test_func_user(self, var: str) -> str:
|
|
@@ -279,7 +279,7 @@ def test_simple_workflow_inst(dbos: DBOS) -> None:
|
|
|
279
279
|
@DBOS.dbos_class()
|
|
280
280
|
class DBOSTestClassInst(DBOSConfiguredInstance):
|
|
281
281
|
def __init__(self) -> None:
|
|
282
|
-
super().__init__("bob"
|
|
282
|
+
super().__init__("bob")
|
|
283
283
|
self.txn_counter: int = 0
|
|
284
284
|
self.wf_counter: int = 0
|
|
285
285
|
self.step_counter: int = 0
|
|
@@ -327,7 +327,7 @@ def test_simple_workflow_inst(dbos: DBOS) -> None:
|
|
|
327
327
|
def test_forgotten_decorator(dbos: DBOS) -> None:
|
|
328
328
|
class DBOSTestRegErr(DBOSConfiguredInstance):
|
|
329
329
|
def __init__(self) -> None:
|
|
330
|
-
super().__init__("bob"
|
|
330
|
+
super().__init__("bob")
|
|
331
331
|
self.txn_counter: int = 0
|
|
332
332
|
self.wf_counter: int = 0
|
|
333
333
|
self.step_counter: int = 0
|
|
@@ -362,7 +362,7 @@ def test_duplicate_reg(dbos: DBOS) -> None:
|
|
|
362
362
|
@DBOS.dbos_class()
|
|
363
363
|
class DBOSTestRegDup(DBOSConfiguredInstance):
|
|
364
364
|
def __init__(self) -> None:
|
|
365
|
-
super().__init__("bob"
|
|
365
|
+
super().__init__("bob")
|
|
366
366
|
|
|
367
367
|
# Duplicate class registration
|
|
368
368
|
with pytest.raises(Exception) as exc_info:
|
|
@@ -370,7 +370,7 @@ def test_duplicate_reg(dbos: DBOS) -> None:
|
|
|
370
370
|
@DBOS.dbos_class()
|
|
371
371
|
class DBOSTestRegDup(DBOSConfiguredInstance): # type: ignore
|
|
372
372
|
def __init__(self) -> None:
|
|
373
|
-
super().__init__("bob"
|
|
373
|
+
super().__init__("bob")
|
|
374
374
|
|
|
375
375
|
assert "Duplicate type registration for class 'DBOSTestRegDup'" == str(
|
|
376
376
|
exc_info.value
|
|
@@ -419,7 +419,7 @@ def test_inst_recovery(dbos: DBOS) -> None:
|
|
|
419
419
|
@DBOS.dbos_class()
|
|
420
420
|
class DBOSTestInstRec(DBOSConfiguredInstance):
|
|
421
421
|
def __init__(self) -> None:
|
|
422
|
-
super().__init__("bob"
|
|
422
|
+
super().__init__("bob")
|
|
423
423
|
|
|
424
424
|
@DBOS.workflow()
|
|
425
425
|
def check_inst(self, arg1: str) -> str:
|
|
@@ -146,6 +146,12 @@ database:
|
|
|
146
146
|
runtimeConfig:
|
|
147
147
|
start:
|
|
148
148
|
- python3 main.py
|
|
149
|
+
application:
|
|
150
|
+
service_url: 'https://service.org'
|
|
151
|
+
service_config:
|
|
152
|
+
port: 80
|
|
153
|
+
user: "user"
|
|
154
|
+
password: "password"
|
|
149
155
|
"""
|
|
150
156
|
|
|
151
157
|
|
|
@@ -164,6 +170,12 @@ def test_config_before_singleton(cleanup_test_databases: None) -> None:
|
|
|
164
170
|
|
|
165
171
|
x = DBOS.config.get("language")
|
|
166
172
|
assert x == "python"
|
|
173
|
+
y = DBOS.config["language"]
|
|
174
|
+
assert y == "python"
|
|
175
|
+
url = DBOS.config["application"]["service_url"]
|
|
176
|
+
assert url == "https://service.org"
|
|
177
|
+
port = DBOS.config["application"]["service_config"]["port"]
|
|
178
|
+
assert port == 80
|
|
167
179
|
|
|
168
180
|
# This is OK, it meant load_config anyway
|
|
169
181
|
dbos: DBOS = DBOS()
|
|
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
|
{dbos-0.6.0a3 → dbos-0.6.0a4}/dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py
RENAMED
|
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
|