dbos 0.5.0a5__tar.gz → 0.5.0a7__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.5.0a5 → dbos-0.5.0a7}/PKG-INFO +1 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/dbos.py +9 -8
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/logger.py +17 -13
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/system_database.py +0 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/pyproject.toml +1 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/atexit_no_launch.py +1 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/conftest.py +2 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_dbos.py +2 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_schema_migration.py +1 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_singleton.py +1 -1
- {dbos-0.5.0a5 → dbos-0.5.0a7}/LICENSE +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/README.md +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/__init__.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/admin_sever.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/application_database.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/cli.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/context.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/core.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/dbos-config.schema.json +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/dbos_config.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/decorators.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/error.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/fastapi.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/migrations/env.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/migrations/script.py.mako +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/migrations/versions/5c361fc04708_added_system_tables.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/py.typed +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/recovery.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/registrations.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/roles.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/scheduler/croniter.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/scheduler/scheduler.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/schemas/__init__.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/schemas/application_database.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/schemas/system_database.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/README.md +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/__package/__init__.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/__package/main.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/__package/schema.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/alembic.ini +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/dbos-config.yaml.dbos +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/migrations/env.py.dbos +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/migrations/script.py.mako +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/templates/hello/start_postgres_docker.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/tracer.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/dbos/utils.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/__init__.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/atexit_no_ctor.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/classdefs.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/more_classdefs.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/scheduler/test_croniter.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/scheduler/test_scheduler.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_admin_server.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_classdecorators.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_concurrency.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_config.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_failures.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_fastapi.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/tests/test_package.py +0 -0
- {dbos-0.5.0a5 → dbos-0.5.0a7}/version/__init__.py +0 -0
|
@@ -72,7 +72,7 @@ from dbos.error import DBOSException, DBOSNonExistentWorkflowError
|
|
|
72
72
|
|
|
73
73
|
from .application_database import ApplicationDatabase
|
|
74
74
|
from .dbos_config import ConfigFile, load_config, set_env_vars
|
|
75
|
-
from .logger import config_logger, dbos_logger, init_logger
|
|
75
|
+
from .logger import add_otlp_to_all_loggers, config_logger, dbos_logger, init_logger
|
|
76
76
|
from .system_database import SystemDatabase
|
|
77
77
|
|
|
78
78
|
# Most DBOS functions are just any callable F, so decorators / wrappers work on F
|
|
@@ -204,7 +204,6 @@ class DBOS:
|
|
|
204
204
|
cls: Type[DBOS],
|
|
205
205
|
fastapi: Optional["FastAPI"] = None,
|
|
206
206
|
config: Optional[ConfigFile] = None,
|
|
207
|
-
launch: bool = True,
|
|
208
207
|
) -> DBOS:
|
|
209
208
|
global _dbos_global_instance
|
|
210
209
|
global _dbos_global_registry
|
|
@@ -219,7 +218,7 @@ class DBOS:
|
|
|
219
218
|
)
|
|
220
219
|
config = _dbos_global_registry.config
|
|
221
220
|
_dbos_global_instance = super().__new__(cls)
|
|
222
|
-
_dbos_global_instance.__init__(fastapi=fastapi, config=config
|
|
221
|
+
_dbos_global_instance.__init__(fastapi=fastapi, config=config) # type: ignore
|
|
223
222
|
else:
|
|
224
223
|
if (config is not None and _dbos_global_instance.config is not config) or (
|
|
225
224
|
_dbos_global_instance.fastapi is not fastapi
|
|
@@ -242,7 +241,6 @@ class DBOS:
|
|
|
242
241
|
self,
|
|
243
242
|
fastapi: Optional["FastAPI"] = None,
|
|
244
243
|
config: Optional[ConfigFile] = None,
|
|
245
|
-
launch: bool = True,
|
|
246
244
|
) -> None:
|
|
247
245
|
if hasattr(self, "_initialized") and self._initialized:
|
|
248
246
|
return
|
|
@@ -270,7 +268,6 @@ class DBOS:
|
|
|
270
268
|
|
|
271
269
|
setup_fastapi_middleware(self.fastapi)
|
|
272
270
|
self.fastapi.on_event("startup")(self.launch)
|
|
273
|
-
launch = False
|
|
274
271
|
|
|
275
272
|
# Register send_stub as a workflow
|
|
276
273
|
def send_temp_workflow(
|
|
@@ -283,8 +280,8 @@ class DBOS:
|
|
|
283
280
|
set_temp_workflow_type(send_temp_workflow, "send")
|
|
284
281
|
self._registry.register_wf_function(TEMP_SEND_WF_NAME, temp_send_wf)
|
|
285
282
|
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
for handler in dbos_logger.handlers:
|
|
284
|
+
handler.flush()
|
|
288
285
|
|
|
289
286
|
@property
|
|
290
287
|
def executor(self) -> ThreadPoolExecutor:
|
|
@@ -342,9 +339,13 @@ class DBOS:
|
|
|
342
339
|
self.executor.submit(func, *args, **kwargs)
|
|
343
340
|
self._registry.pollers = []
|
|
344
341
|
|
|
345
|
-
dbos_logger.info("DBOS
|
|
342
|
+
dbos_logger.info("DBOS launched")
|
|
343
|
+
|
|
344
|
+
# Flush handlers and add OTLP to all loggers if enabled
|
|
345
|
+
# to enable their export in DBOS Cloud
|
|
346
346
|
for handler in dbos_logger.handlers:
|
|
347
347
|
handler.flush()
|
|
348
|
+
add_otlp_to_all_loggers()
|
|
348
349
|
|
|
349
350
|
def _destroy(self) -> None:
|
|
350
351
|
self._initialized = False
|
|
@@ -12,6 +12,7 @@ if TYPE_CHECKING:
|
|
|
12
12
|
from dbos.dbos_config import ConfigFile
|
|
13
13
|
|
|
14
14
|
dbos_logger = logging.getLogger("dbos")
|
|
15
|
+
otlp_handler, otlp_transformer = None, None
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class DBOSLogTransformer(logging.Filter):
|
|
@@ -73,25 +74,28 @@ def config_logger(config: "ConfigFile") -> None:
|
|
|
73
74
|
export_timeout_millis=5000,
|
|
74
75
|
)
|
|
75
76
|
)
|
|
77
|
+
global otlp_handler
|
|
76
78
|
otlp_handler = LoggingHandler(logger_provider=log_provider)
|
|
77
79
|
|
|
78
80
|
# Attach DBOS-specific attributes to all log entries.
|
|
81
|
+
global otlp_transformer
|
|
79
82
|
otlp_transformer = DBOSLogTransformer()
|
|
80
83
|
|
|
81
|
-
# Direct
|
|
82
|
-
|
|
84
|
+
# Direct DBOS logs to OTLP
|
|
85
|
+
dbos_logger.addHandler(otlp_handler)
|
|
86
|
+
dbos_logger.addFilter(otlp_transformer)
|
|
83
87
|
|
|
84
88
|
|
|
85
|
-
def add_otlp_to_all_loggers(
|
|
86
|
-
otlp_handler
|
|
87
|
-
|
|
88
|
-
root = logging.root
|
|
89
|
+
def add_otlp_to_all_loggers() -> None:
|
|
90
|
+
if otlp_handler is not None and otlp_transformer is not None:
|
|
91
|
+
root = logging.root
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
root.addHandler(otlp_handler)
|
|
94
|
+
root.addFilter(otlp_transformer)
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
for logger_name in root.manager.loggerDict:
|
|
97
|
+
if logger_name != dbos_logger.name:
|
|
98
|
+
logger = logging.getLogger(logger_name)
|
|
99
|
+
if not logger.propagate:
|
|
100
|
+
logger.addHandler(otlp_handler)
|
|
101
|
+
logger.addFilter(otlp_transformer)
|
|
@@ -734,7 +734,6 @@ class SystemDatabase:
|
|
|
734
734
|
)
|
|
735
735
|
notification_cursor = self.notification_conn.cursor()
|
|
736
736
|
|
|
737
|
-
dbos_logger.info("Listening to notifications")
|
|
738
737
|
notification_cursor.execute("LISTEN dbos_notifications_channel")
|
|
739
738
|
notification_cursor.execute("LISTEN dbos_workflow_events_channel")
|
|
740
739
|
while self._run_background_processes:
|
|
@@ -103,7 +103,8 @@ def dbos(
|
|
|
103
103
|
# launch themselves.
|
|
104
104
|
# If your test is tricky and has a problem with this, use a different
|
|
105
105
|
# fixture that does not launch.
|
|
106
|
-
dbos = DBOS(config=config
|
|
106
|
+
dbos = DBOS(config=config)
|
|
107
|
+
dbos.launch()
|
|
107
108
|
|
|
108
109
|
yield dbos
|
|
109
110
|
DBOS.destroy()
|
|
@@ -472,7 +472,7 @@ def test_recovery_thread(config: ConfigFile, dbos: DBOS) -> None:
|
|
|
472
472
|
)
|
|
473
473
|
|
|
474
474
|
dbos._destroy() # Unusual pattern - reusing the memory
|
|
475
|
-
dbos.__init__(config=config
|
|
475
|
+
dbos.__init__(config=config) # type: ignore
|
|
476
476
|
|
|
477
477
|
@DBOS.workflow() # type: ignore
|
|
478
478
|
def test_workflow(var: str) -> str:
|
|
@@ -685,6 +685,7 @@ def test_without_fastapi() -> None:
|
|
|
685
685
|
sys.meta_path.remove(blocker)
|
|
686
686
|
|
|
687
687
|
dbos = DBOS(config=config)
|
|
688
|
+
dbos.launch()
|
|
688
689
|
|
|
689
690
|
try:
|
|
690
691
|
|
|
@@ -22,7 +22,7 @@ def test_dbos_singleton(cleanup_test_databases: None) -> None:
|
|
|
22
22
|
# then imports more
|
|
23
23
|
from tests.classdefs import DBOSSendRecv, DBOSTestClass, DBOSTestRoles
|
|
24
24
|
|
|
25
|
-
dbos: DBOS = DBOS(None, default_config()
|
|
25
|
+
dbos: DBOS = DBOS(None, default_config())
|
|
26
26
|
|
|
27
27
|
from tests.more_classdefs import DBOSWFEvents, wfFunc
|
|
28
28
|
|
|
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.5.0a5 → dbos-0.5.0a7}/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
|