dbos 0.25.1__py3-none-any.whl → 0.26.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.
- dbos/__init__.py +1 -2
- dbos/_admin_server.py +56 -6
- dbos/_app_db.py +135 -8
- dbos/_client.py +175 -15
- dbos/_conductor/conductor.py +2 -1
- dbos/_conductor/protocol.py +1 -2
- dbos/_context.py +62 -0
- dbos/_core.py +115 -65
- dbos/_dbos.py +152 -106
- dbos/_dbos_config.py +53 -67
- dbos/_debug.py +1 -1
- dbos/_docker_pg_helper.py +191 -0
- dbos/_error.py +61 -15
- dbos/_event_loop.py +67 -0
- dbos/_kafka.py +1 -1
- dbos/_migrations/versions/83f3732ae8e7_workflow_timeout.py +44 -0
- dbos/_queue.py +2 -1
- dbos/_recovery.py +1 -1
- dbos/_registrations.py +20 -5
- dbos/_scheduler.py +1 -1
- dbos/_schemas/application_database.py +1 -0
- dbos/_schemas/system_database.py +3 -1
- dbos/_sys_db.py +533 -130
- dbos/_utils.py +2 -0
- dbos/_workflow_commands.py +49 -104
- dbos/cli/cli.py +70 -4
- dbos/dbos-config.schema.json +26 -21
- {dbos-0.25.1.dist-info → dbos-0.26.0.dist-info}/METADATA +1 -1
- {dbos-0.25.1.dist-info → dbos-0.26.0.dist-info}/RECORD +32 -33
- dbos/_cloudutils/authentication.py +0 -163
- dbos/_cloudutils/cloudutils.py +0 -254
- dbos/_cloudutils/databases.py +0 -241
- dbos/_db_wizard.py +0 -220
- {dbos-0.25.1.dist-info → dbos-0.26.0.dist-info}/WHEEL +0 -0
- {dbos-0.25.1.dist-info → dbos-0.26.0.dist-info}/entry_points.txt +0 -0
- {dbos-0.25.1.dist-info → dbos-0.26.0.dist-info}/licenses/LICENSE +0 -0
dbos/_registrations.py
CHANGED
|
@@ -34,6 +34,7 @@ def set_temp_workflow_type(f: Any, name: TempWorkflowType) -> None:
|
|
|
34
34
|
|
|
35
35
|
@dataclass
|
|
36
36
|
class DBOSClassInfo:
|
|
37
|
+
registered_name: str
|
|
37
38
|
def_required_roles: Optional[List[str]] = None
|
|
38
39
|
|
|
39
40
|
|
|
@@ -50,14 +51,20 @@ class DBOSFuncInfo:
|
|
|
50
51
|
class_info: Optional[DBOSClassInfo] = None
|
|
51
52
|
func_type: DBOSFuncType = DBOSFuncType.Unknown
|
|
52
53
|
required_roles: Optional[List[str]] = None
|
|
53
|
-
max_recovery_attempts: int = DEFAULT_MAX_RECOVERY_ATTEMPTS
|
|
54
|
+
max_recovery_attempts: Optional[int] = DEFAULT_MAX_RECOVERY_ATTEMPTS
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
def get_or_create_class_info(
|
|
57
|
+
def get_or_create_class_info(
|
|
58
|
+
cls: Type[Any], provided_name: Optional[str] = None
|
|
59
|
+
) -> DBOSClassInfo:
|
|
57
60
|
if hasattr(cls, "dbos_class_decorator_info"):
|
|
58
61
|
ci: DBOSClassInfo = getattr(cls, "dbos_class_decorator_info")
|
|
59
62
|
return ci
|
|
60
|
-
|
|
63
|
+
class_name = _class_fqn(cls)
|
|
64
|
+
# Use the provided name instead of the class name if it is not None
|
|
65
|
+
if provided_name is not None:
|
|
66
|
+
class_name = provided_name
|
|
67
|
+
ci = DBOSClassInfo(registered_name=class_name)
|
|
61
68
|
setattr(cls, "dbos_class_decorator_info", ci)
|
|
62
69
|
|
|
63
70
|
# Tell all DBOS functions about this
|
|
@@ -166,16 +173,24 @@ def get_config_name(
|
|
|
166
173
|
return None
|
|
167
174
|
|
|
168
175
|
|
|
176
|
+
def _class_fqn(cls: type) -> str:
|
|
177
|
+
"""Returns the registered name of the given class. If the class name was not overridden at registration time, it returns the qualified name of the class."""
|
|
178
|
+
ci = get_class_info(cls)
|
|
179
|
+
if ci is not None:
|
|
180
|
+
return ci.registered_name
|
|
181
|
+
return cls.__qualname__
|
|
182
|
+
|
|
183
|
+
|
|
169
184
|
def get_dbos_class_name(
|
|
170
185
|
fi: Optional[DBOSFuncInfo], func: Callable[..., Any], args: Tuple[Any, ...]
|
|
171
186
|
) -> Optional[str]:
|
|
172
187
|
if fi and fi.func_type != DBOSFuncType.Unknown and len(args) > 0:
|
|
173
188
|
if fi.func_type == DBOSFuncType.Instance:
|
|
174
189
|
first_arg = args[0]
|
|
175
|
-
return
|
|
190
|
+
return _class_fqn(first_arg.__class__)
|
|
176
191
|
if fi.func_type == DBOSFuncType.Class:
|
|
177
192
|
first_arg = args[0]
|
|
178
|
-
return
|
|
193
|
+
return _class_fqn(first_arg)
|
|
179
194
|
return None
|
|
180
195
|
|
|
181
196
|
# Check for improperly-registered functions
|
dbos/_scheduler.py
CHANGED
|
@@ -52,7 +52,7 @@ def scheduled(
|
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
global scheduler_queue
|
|
55
|
-
scheduler_queue =
|
|
55
|
+
scheduler_queue = dbosreg.get_internal_queue()
|
|
56
56
|
stop_event = threading.Event()
|
|
57
57
|
dbosreg.register_poller(stop_event, scheduler_loop, func, cron, stop_event)
|
|
58
58
|
return func
|
dbos/_schemas/system_database.py
CHANGED
|
@@ -54,7 +54,9 @@ class SystemSchema:
|
|
|
54
54
|
nullable=True,
|
|
55
55
|
server_default=text("'0'::bigint"),
|
|
56
56
|
),
|
|
57
|
-
Column("queue_name", Text),
|
|
57
|
+
Column("queue_name", Text, nullable=True),
|
|
58
|
+
Column("workflow_timeout_ms", BigInteger, nullable=True),
|
|
59
|
+
Column("workflow_deadline_epoch_ms", BigInteger, nullable=True),
|
|
58
60
|
Index("workflow_status_created_at_index", "created_at"),
|
|
59
61
|
Index("workflow_status_executor_id_index", "executor_id"),
|
|
60
62
|
)
|