dbos 0.22.0a9__tar.gz → 0.22.0a11__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.

Files changed (90) hide show
  1. {dbos-0.22.0a9 → dbos-0.22.0a11}/PKG-INFO +1 -1
  2. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_cloudutils/cloudutils.py +4 -2
  3. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_cloudutils/databases.py +4 -0
  4. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_core.py +5 -3
  5. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_dbos.py +12 -3
  6. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_error.py +11 -0
  7. {dbos-0.22.0a9 → dbos-0.22.0a11}/pyproject.toml +1 -1
  8. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_dbos.py +15 -1
  9. {dbos-0.22.0a9 → dbos-0.22.0a11}/LICENSE +0 -0
  10. {dbos-0.22.0a9 → dbos-0.22.0a11}/README.md +0 -0
  11. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/__init__.py +0 -0
  12. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_admin_server.py +0 -0
  13. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_app_db.py +0 -0
  14. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_classproperty.py +0 -0
  15. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_cloudutils/authentication.py +0 -0
  16. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_context.py +0 -0
  17. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_croniter.py +0 -0
  18. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_db_wizard.py +0 -0
  19. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_dbos_config.py +0 -0
  20. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_fastapi.py +0 -0
  21. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_flask.py +0 -0
  22. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_kafka.py +0 -0
  23. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_kafka_message.py +0 -0
  24. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_logger.py +0 -0
  25. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/env.py +0 -0
  26. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/script.py.mako +0 -0
  27. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/04ca4f231047_workflow_queues_executor_id.py +0 -0
  28. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/50f3227f0b4b_fix_job_queue.py +0 -0
  29. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/5c361fc04708_added_system_tables.py +0 -0
  30. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
  31. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/d76646551a6b_job_queue_limiter.py +0 -0
  32. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/d76646551a6c_workflow_queue.py +0 -0
  33. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_migrations/versions/eab0cc1d9a14_job_queue.py +0 -0
  34. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_outcome.py +0 -0
  35. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_queue.py +0 -0
  36. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_recovery.py +0 -0
  37. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_registrations.py +0 -0
  38. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_request.py +0 -0
  39. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_roles.py +0 -0
  40. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_scheduler.py +0 -0
  41. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_schemas/__init__.py +0 -0
  42. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_schemas/application_database.py +0 -0
  43. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_schemas/system_database.py +0 -0
  44. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_serialization.py +0 -0
  45. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_sys_db.py +0 -0
  46. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/README.md +0 -0
  47. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/__package/__init__.py +0 -0
  48. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/__package/main.py +0 -0
  49. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/__package/schema.py +0 -0
  50. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/alembic.ini +0 -0
  51. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos +0 -0
  52. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/migrations/env.py.dbos +0 -0
  53. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/migrations/script.py.mako +0 -0
  54. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py +0 -0
  55. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_templates/dbos-db-starter/start_postgres_docker.py +0 -0
  56. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_tracer.py +0 -0
  57. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/_workflow_commands.py +0 -0
  58. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/cli/_github_init.py +0 -0
  59. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/cli/_template_init.py +0 -0
  60. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/cli/cli.py +0 -0
  61. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/dbos-config.schema.json +0 -0
  62. {dbos-0.22.0a9 → dbos-0.22.0a11}/dbos/py.typed +0 -0
  63. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/__init__.py +0 -0
  64. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/atexit_no_ctor.py +0 -0
  65. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/atexit_no_launch.py +0 -0
  66. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/classdefs.py +0 -0
  67. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/conftest.py +0 -0
  68. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/more_classdefs.py +0 -0
  69. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/queuedworkflow.py +0 -0
  70. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_admin_server.py +0 -0
  71. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_async.py +0 -0
  72. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_classdecorators.py +0 -0
  73. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_concurrency.py +0 -0
  74. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_config.py +0 -0
  75. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_croniter.py +0 -0
  76. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_failures.py +0 -0
  77. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_fastapi.py +0 -0
  78. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_fastapi_roles.py +0 -0
  79. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_flask.py +0 -0
  80. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_kafka.py +0 -0
  81. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_outcome.py +0 -0
  82. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_package.py +0 -0
  83. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_queue.py +0 -0
  84. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_scheduler.py +0 -0
  85. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_schema_migration.py +0 -0
  86. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_singleton.py +0 -0
  87. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_spans.py +0 -0
  88. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_sqlalchemy.py +0 -0
  89. {dbos-0.22.0a9 → dbos-0.22.0a11}/tests/test_workflow_cmds.py +0 -0
  90. {dbos-0.22.0a9 → dbos-0.22.0a11}/version/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.22.0a9
3
+ Version: 0.22.0a11
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -29,9 +29,11 @@ class DBOSCloudCredentials:
29
29
  @dataclass
30
30
  class UserProfile:
31
31
  Name: str
32
- Email: str
33
32
  Organization: str
34
- SubscriptionPlan: str
33
+
34
+ def __init__(self, **kwargs: Any) -> None:
35
+ self.Name = kwargs.get("Name", "")
36
+ self.Organization = kwargs.get("Organization", "")
35
37
 
36
38
 
37
39
  class AppLanguages(Enum):
@@ -23,6 +23,10 @@ class UserDBCredentials:
23
23
  RoleName: str
24
24
  Password: str
25
25
 
26
+ def __init__(self, **kwargs: Any) -> None:
27
+ self.RoleName = kwargs.get("RoleName", "")
28
+ self.Password = kwargs.get("Password", "")
29
+
26
30
 
27
31
  @dataclass
28
32
  class UserDBInstance:
@@ -524,7 +524,7 @@ def decorate_workflow(
524
524
  ) -> Callable[[Callable[P, R]], Callable[P, R]]:
525
525
  def _workflow_decorator(func: Callable[P, R]) -> Callable[P, R]:
526
526
  wrapped_func = workflow_wrapper(reg, func, max_recovery_attempts)
527
- reg.register_wf_function(func.__qualname__, wrapped_func)
527
+ reg.register_wf_function(func.__qualname__, wrapped_func, "workflow")
528
528
  return wrapped_func
529
529
 
530
530
  return _workflow_decorator
@@ -676,7 +676,9 @@ def decorate_transaction(
676
676
  wrapped_wf = workflow_wrapper(dbosreg, temp_wf)
677
677
  set_dbos_func_name(temp_wf, "<temp>." + func.__qualname__)
678
678
  set_temp_workflow_type(temp_wf, "transaction")
679
- dbosreg.register_wf_function(get_dbos_func_name(temp_wf), wrapped_wf)
679
+ dbosreg.register_wf_function(
680
+ get_dbos_func_name(temp_wf), wrapped_wf, "transaction"
681
+ )
680
682
  wrapper.__orig_func = temp_wf # type: ignore
681
683
  set_func_info(wrapped_wf, get_or_create_func_info(func))
682
684
  set_func_info(temp_wf, get_or_create_func_info(func))
@@ -827,7 +829,7 @@ def decorate_step(
827
829
  wrapped_wf = workflow_wrapper(dbosreg, temp_wf)
828
830
  set_dbos_func_name(temp_wf, "<temp>." + func.__qualname__)
829
831
  set_temp_workflow_type(temp_wf, "step")
830
- dbosreg.register_wf_function(get_dbos_func_name(temp_wf), wrapped_wf)
832
+ dbosreg.register_wf_function(get_dbos_func_name(temp_wf), wrapped_wf, "step")
831
833
  wrapper.__orig_func = temp_wf # type: ignore
832
834
  set_func_info(wrapped_wf, get_or_create_func_info(func))
833
835
  set_func_info(temp_wf, get_or_create_func_info(func))
@@ -85,7 +85,11 @@ from ._context import (
85
85
  get_local_dbos_context,
86
86
  )
87
87
  from ._dbos_config import ConfigFile, load_config, set_env_vars
88
- from ._error import DBOSException, DBOSNonExistentWorkflowError
88
+ from ._error import (
89
+ DBOSConflictingRegistrationError,
90
+ DBOSException,
91
+ DBOSNonExistentWorkflowError,
92
+ )
89
93
  from ._logger import add_otlp_to_all_loggers, dbos_logger
90
94
  from ._sys_db import SystemDatabase
91
95
 
@@ -144,6 +148,7 @@ RegisteredJob = Tuple[
144
148
  class DBOSRegistry:
145
149
  def __init__(self) -> None:
146
150
  self.workflow_info_map: dict[str, Workflow[..., Any]] = {}
151
+ self.function_type_map: dict[str, str] = {}
147
152
  self.class_info_map: dict[str, type] = {}
148
153
  self.instance_info_map: dict[str, object] = {}
149
154
  self.queue_info_map: dict[str, Queue] = {}
@@ -151,7 +156,11 @@ class DBOSRegistry:
151
156
  self.dbos: Optional[DBOS] = None
152
157
  self.config: Optional[ConfigFile] = None
153
158
 
154
- def register_wf_function(self, name: str, wrapped_func: F) -> None:
159
+ def register_wf_function(self, name: str, wrapped_func: F, functype: str) -> None:
160
+ if name in self.function_type_map:
161
+ if self.function_type_map[name] != functype:
162
+ raise DBOSConflictingRegistrationError(name)
163
+ self.function_type_map[name] = functype
155
164
  self.workflow_info_map[name] = wrapped_func
156
165
 
157
166
  def register_class(self, cls: type, ci: DBOSClassInfo) -> None:
@@ -324,7 +333,7 @@ class DBOS:
324
333
  temp_send_wf = workflow_wrapper(self._registry, send_temp_workflow)
325
334
  set_dbos_func_name(send_temp_workflow, TEMP_SEND_WF_NAME)
326
335
  set_temp_workflow_type(send_temp_workflow, "send")
327
- self._registry.register_wf_function(TEMP_SEND_WF_NAME, temp_send_wf)
336
+ self._registry.register_wf_function(TEMP_SEND_WF_NAME, temp_send_wf, "send")
328
337
 
329
338
  for handler in dbos_logger.handlers:
330
339
  handler.flush()
@@ -36,6 +36,7 @@ class DBOSErrorCode(Enum):
36
36
  MaxStepRetriesExceeded = 7
37
37
  NotAuthorized = 8
38
38
  ConflictingWorkflowError = 9
39
+ ConflictingRegistrationError = 25
39
40
 
40
41
 
41
42
  class DBOSWorkflowConflictIDError(DBOSException):
@@ -127,3 +128,13 @@ class DBOSMaxStepRetriesExceeded(DBOSException):
127
128
  "Step reached maximum retries.",
128
129
  dbos_error_code=DBOSErrorCode.MaxStepRetriesExceeded.value,
129
130
  )
131
+
132
+
133
+ class DBOSConflictingRegistrationError(DBOSException):
134
+ """Exception raised when conflicting decorators are applied to the same function."""
135
+
136
+ def __init__(self, name: str) -> None:
137
+ super().__init__(
138
+ f"Operation (Name: {name}) is already registered with a conflicting function type",
139
+ dbos_error_code=DBOSErrorCode.ConflictingRegistrationError.value,
140
+ )
@@ -27,7 +27,7 @@ dependencies = [
27
27
  ]
28
28
  requires-python = ">=3.9"
29
29
  readme = "README.md"
30
- version = "0.22.0a9"
30
+ version = "0.22.0a11"
31
31
 
32
32
  [project.license]
33
33
  text = "MIT"
@@ -16,7 +16,7 @@ from dbos import DBOS, ConfigFile, SetWorkflowID, WorkflowHandle, WorkflowStatus
16
16
 
17
17
  # Private API because this is a test
18
18
  from dbos._context import assert_current_dbos_context, get_local_dbos_context
19
- from dbos._error import DBOSMaxStepRetriesExceeded
19
+ from dbos._error import DBOSConflictingRegistrationError, DBOSMaxStepRetriesExceeded
20
20
  from dbos._schemas.system_database import SystemSchema
21
21
  from dbos._sys_db import GetWorkflowsInput
22
22
 
@@ -1208,6 +1208,20 @@ def test_destroy_semantics(dbos: DBOS, config: ConfigFile) -> None:
1208
1208
  assert test_workflow(var) == var
1209
1209
 
1210
1210
 
1211
+ def test_double_decoration(dbos: DBOS) -> None:
1212
+ with pytest.raises(
1213
+ DBOSConflictingRegistrationError,
1214
+ match="is already registered with a conflicting function type",
1215
+ ):
1216
+
1217
+ @DBOS.step()
1218
+ @DBOS.transaction()
1219
+ def my_function() -> None:
1220
+ pass
1221
+
1222
+ my_function()
1223
+
1224
+
1211
1225
  def test_app_version(config: ConfigFile) -> None:
1212
1226
  def is_hex(s: str) -> bool:
1213
1227
  return all(c in "0123456789abcdefABCDEF" for c in s)
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
File without changes
File without changes
File without changes
File without changes
File without changes