dbos 0.20.0a5__tar.gz → 0.20.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.20.0a5 → dbos-0.20.0a7}/PKG-INFO +1 -1
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_dbos.py +1 -1
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_sys_db.py +1 -1
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/cli/cli.py +4 -2
- {dbos-0.20.0a5 → dbos-0.20.0a7}/pyproject.toml +1 -1
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/conftest.py +6 -6
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_async.py +1 -1
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_dbos.py +16 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_package.py +25 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/LICENSE +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/README.md +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/__init__.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_admin_server.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_app_db.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_classproperty.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_cloudutils/authentication.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_cloudutils/cloudutils.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_cloudutils/databases.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_context.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_core.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_croniter.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_db_wizard.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_dbos_config.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_error.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_fastapi.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_flask.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_kafka.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_kafka_message.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_logger.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/env.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/script.py.mako +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/04ca4f231047_workflow_queues_executor_id.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/50f3227f0b4b_fix_job_queue.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/5c361fc04708_added_system_tables.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/d76646551a6b_job_queue_limiter.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/d76646551a6c_workflow_queue.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/eab0cc1d9a14_job_queue.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_outcome.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_queue.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_recovery.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_registrations.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_request.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_roles.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_scheduler.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_schemas/__init__.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_schemas/application_database.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_schemas/system_database.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_serialization.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/README.md +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/__package/__init__.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/__package/main.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/__package/schema.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/alembic.ini +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/migrations/env.py.dbos +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/migrations/script.py.mako +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_templates/dbos-db-starter/start_postgres_docker.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_tracer.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/_workflow_commands.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/cli/_github_init.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/cli/_template_init.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/dbos-config.schema.json +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/dbos/py.typed +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/__init__.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/atexit_no_ctor.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/atexit_no_launch.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/classdefs.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/more_classdefs.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/queuedworkflow.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_admin_server.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_classdecorators.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_concurrency.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_config.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_croniter.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_failures.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_fastapi.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_fastapi_roles.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_flask.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_kafka.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_outcome.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_queue.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_scheduler.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_schema_migration.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_singleton.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_spans.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/tests/test_workflow_cmds.py +0 -0
- {dbos-0.20.0a5 → dbos-0.20.0a7}/version/__init__.py +0 -0
|
@@ -245,7 +245,7 @@ class DBOS:
|
|
|
245
245
|
return _dbos_global_instance
|
|
246
246
|
|
|
247
247
|
@classmethod
|
|
248
|
-
def destroy(cls, *, destroy_registry: bool =
|
|
248
|
+
def destroy(cls, *, destroy_registry: bool = False) -> None:
|
|
249
249
|
global _dbos_global_instance
|
|
250
250
|
if _dbos_global_instance is not None:
|
|
251
251
|
_dbos_global_instance._destroy()
|
|
@@ -367,7 +367,7 @@ class SystemDatabase:
|
|
|
367
367
|
with self.engine.begin() as c:
|
|
368
368
|
stmt = (
|
|
369
369
|
sa.update(SystemSchema.workflow_status)
|
|
370
|
-
.where(SystemSchema.
|
|
370
|
+
.where(SystemSchema.workflow_status.c.workflow_uuid == workflow_uuid)
|
|
371
371
|
.values(
|
|
372
372
|
status=status,
|
|
373
373
|
)
|
|
@@ -100,13 +100,15 @@ def init(
|
|
|
100
100
|
] = False,
|
|
101
101
|
) -> None:
|
|
102
102
|
try:
|
|
103
|
+
|
|
103
104
|
git_templates = ["dbos-app-starter", "dbos-cron-starter"]
|
|
104
105
|
templates_dir = get_templates_directory()
|
|
105
106
|
templates = git_templates + [
|
|
106
107
|
x.name for x in os.scandir(templates_dir) if x.is_dir()
|
|
107
108
|
]
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
|
|
110
|
+
if config and template is None:
|
|
111
|
+
template = templates[-1]
|
|
110
112
|
|
|
111
113
|
if template:
|
|
112
114
|
if template not in templates:
|
|
@@ -98,7 +98,7 @@ def cleanup_test_databases(config: ConfigFile, postgres_db_engine: sa.Engine) ->
|
|
|
98
98
|
def dbos(
|
|
99
99
|
config: ConfigFile, cleanup_test_databases: None
|
|
100
100
|
) -> Generator[DBOS, Any, None]:
|
|
101
|
-
DBOS.destroy()
|
|
101
|
+
DBOS.destroy(destroy_registry=True)
|
|
102
102
|
|
|
103
103
|
# This launches for test convenience.
|
|
104
104
|
# Tests add to running DBOS and then call stuff without adding
|
|
@@ -109,14 +109,14 @@ def dbos(
|
|
|
109
109
|
DBOS.launch()
|
|
110
110
|
|
|
111
111
|
yield dbos
|
|
112
|
-
DBOS.destroy()
|
|
112
|
+
DBOS.destroy(destroy_registry=True)
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
@pytest.fixture()
|
|
116
116
|
def dbos_fastapi(
|
|
117
117
|
config: ConfigFile, cleanup_test_databases: None
|
|
118
118
|
) -> Generator[Tuple[DBOS, FastAPI], Any, None]:
|
|
119
|
-
DBOS.destroy()
|
|
119
|
+
DBOS.destroy(destroy_registry=True)
|
|
120
120
|
app = FastAPI()
|
|
121
121
|
dbos = DBOS(fastapi=app, config=config)
|
|
122
122
|
|
|
@@ -125,14 +125,14 @@ def dbos_fastapi(
|
|
|
125
125
|
DBOS.launch()
|
|
126
126
|
|
|
127
127
|
yield dbos, app
|
|
128
|
-
DBOS.destroy()
|
|
128
|
+
DBOS.destroy(destroy_registry=True)
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
@pytest.fixture()
|
|
132
132
|
def dbos_flask(
|
|
133
133
|
config: ConfigFile, cleanup_test_databases: None
|
|
134
134
|
) -> Generator[Tuple[DBOS, Flask], Any, None]:
|
|
135
|
-
DBOS.destroy()
|
|
135
|
+
DBOS.destroy(destroy_registry=True)
|
|
136
136
|
app = Flask(__name__)
|
|
137
137
|
|
|
138
138
|
dbos = DBOS(flask=app, config=config)
|
|
@@ -142,7 +142,7 @@ def dbos_flask(
|
|
|
142
142
|
DBOS.launch()
|
|
143
143
|
|
|
144
144
|
yield dbos, app
|
|
145
|
-
DBOS.destroy()
|
|
145
|
+
DBOS.destroy(destroy_registry=True)
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
# Pretty-print test names
|
|
@@ -303,7 +303,7 @@ def test_async_tx_raises(config: ConfigFile) -> None:
|
|
|
303
303
|
pass
|
|
304
304
|
|
|
305
305
|
# destroy call needed to avoid "functions were registered but DBOS() was not called" warning
|
|
306
|
-
DBOS.destroy()
|
|
306
|
+
DBOS.destroy(destroy_registry=True)
|
|
307
307
|
|
|
308
308
|
|
|
309
309
|
@pytest.mark.asyncio
|
|
@@ -1212,3 +1212,19 @@ def test_debug_logging(dbos: DBOS, caplog: pytest.LogCaptureFixture) -> None:
|
|
|
1212
1212
|
|
|
1213
1213
|
# Reset logging
|
|
1214
1214
|
logging.getLogger("dbos").propagate = original_propagate
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
def test_destroy_semantics(dbos: DBOS, config: ConfigFile) -> None:
|
|
1218
|
+
|
|
1219
|
+
@DBOS.workflow()
|
|
1220
|
+
def test_workflow(var: str) -> str:
|
|
1221
|
+
return var
|
|
1222
|
+
|
|
1223
|
+
var = "test"
|
|
1224
|
+
assert test_workflow(var) == var
|
|
1225
|
+
|
|
1226
|
+
DBOS.destroy()
|
|
1227
|
+
DBOS(config=config)
|
|
1228
|
+
DBOS.launch()
|
|
1229
|
+
|
|
1230
|
+
assert test_workflow(var) == var
|
|
@@ -9,6 +9,7 @@ import urllib.error
|
|
|
9
9
|
import urllib.request
|
|
10
10
|
|
|
11
11
|
import sqlalchemy as sa
|
|
12
|
+
import yaml
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
def test_package(build_wheel: str, postgres_db_engine: sa.Engine) -> None:
|
|
@@ -90,3 +91,27 @@ def test_package(build_wheel: str, postgres_db_engine: sa.Engine) -> None:
|
|
|
90
91
|
finally:
|
|
91
92
|
os.kill(process.pid, signal.SIGINT)
|
|
92
93
|
process.wait()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_init_config() -> None:
|
|
97
|
+
app_name = "example-name"
|
|
98
|
+
expected_yaml = {
|
|
99
|
+
"name": app_name,
|
|
100
|
+
"language": "python",
|
|
101
|
+
"runtimeConfig": {"start": ["fastapi run ./main.py"]},
|
|
102
|
+
"database": {"migrate": ["echo 'No migrations specified'"]},
|
|
103
|
+
"telemetry": {"logs": {"logLevel": "INFO"}},
|
|
104
|
+
}
|
|
105
|
+
with tempfile.TemporaryDirectory() as temp_path:
|
|
106
|
+
subprocess.check_call(
|
|
107
|
+
["dbos", "init", app_name, "--config"],
|
|
108
|
+
cwd=temp_path,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
config_path = os.path.join(temp_path, "dbos-config.yaml")
|
|
112
|
+
assert os.path.exists(config_path)
|
|
113
|
+
|
|
114
|
+
with open(config_path) as f:
|
|
115
|
+
actual_yaml = yaml.safe_load(f)
|
|
116
|
+
|
|
117
|
+
assert actual_yaml == expected_yaml
|
|
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.20.0a5 → dbos-0.20.0a7}/dbos/_migrations/versions/5c361fc04708_added_system_tables.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
|
|
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
|