dbos 0.6.0a0__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.0a0 → dbos-0.6.0a4}/PKG-INFO +19 -17
- {dbos-0.6.0a0 → dbos-0.6.0a4}/README.md +18 -16
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/dbos.py +8 -6
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/dbos_config.py +2 -1
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/__package/main.py +15 -22
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/__package/schema.py +2 -2
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py +2 -2
- {dbos-0.6.0a0 → dbos-0.6.0a4}/pyproject.toml +1 -1
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/classdefs.py +1 -1
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_classdecorators.py +6 -6
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_singleton.py +12 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/LICENSE +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/__init__.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/admin_sever.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/application_database.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/cli.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/context.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/core.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/dbos-config.schema.json +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/decorators.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/error.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/fastapi.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/flask.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/logger.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/migrations/env.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/migrations/script.py.mako +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/migrations/versions/5c361fc04708_added_system_tables.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/py.typed +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/recovery.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/registrations.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/request.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/roles.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/scheduler/croniter.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/scheduler/scheduler.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/schemas/__init__.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/schemas/application_database.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/schemas/system_database.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/system_database.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/README.md +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/__package/__init__.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/alembic.ini +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/dbos-config.yaml.dbos +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/migrations/env.py.dbos +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/migrations/script.py.mako +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/start_postgres_docker.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/tracer.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/utils.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/__init__.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/atexit_no_ctor.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/atexit_no_launch.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/conftest.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/more_classdefs.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/scheduler/test_croniter.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/scheduler/test_scheduler.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_admin_server.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_concurrency.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_config.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_dbos.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_failures.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_fastapi.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_fastapi_roles.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_flask.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_package.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/tests/test_schema_migration.py +0 -0
- {dbos-0.6.0a0 → dbos-0.6.0a4}/version/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dbos
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.0a4
|
|
4
4
|
Summary: Ultra-lightweight durable execution in Python
|
|
5
5
|
Author-Email: "DBOS, Inc." <contact@dbos.dev>
|
|
6
6
|
License: MIT
|
|
@@ -21,20 +21,17 @@ Requires-Dist: psutil>=6.0.0
|
|
|
21
21
|
Requires-Dist: tomlkit>=0.13.2
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
24
|
-
## 🚀 DBOS Transact - Ultra-Lightweight Durable Execution in Python 🚀
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
<div align="center">
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
# DBOS Transact: Ultra-Lightweight Durable Execution
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
#### [Documentation](https://docs.dbos.dev/) • [Examples](https://docs.dbos.dev/examples) • [Github](https://github.com/dbos-inc) • [Discord](https://discord.com/invite/jsmC6pXGgX)
|
|
30
|
+
</div>
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
**DBOS Python is under construction! 🚧🚧🚧 Check back regularly for updates, release coming in mid-September!**
|
|
36
|
-
|
|
37
|
-
DBOS Transact is a **Python library** providing ultra-lightweight durable execution.
|
|
34
|
+
DBOS Transact is a Python library providing **ultra-lightweight durable execution**.
|
|
38
35
|
For example:
|
|
39
36
|
|
|
40
37
|
```python
|
|
@@ -69,14 +66,14 @@ Some more cool features include:
|
|
|
69
66
|
|
|
70
67
|
## Getting Started
|
|
71
68
|
|
|
72
|
-
|
|
69
|
+
Install and configure with:
|
|
73
70
|
|
|
74
71
|
```shell
|
|
75
|
-
pip install
|
|
72
|
+
pip install dbos
|
|
76
73
|
dbos init --config
|
|
77
74
|
```
|
|
78
75
|
|
|
79
|
-
|
|
76
|
+
Then, try it out with this simple program (requires Postgres):
|
|
80
77
|
|
|
81
78
|
```python
|
|
82
79
|
from fastapi import FastAPI
|
|
@@ -106,22 +103,27 @@ def endpoint():
|
|
|
106
103
|
workflow()
|
|
107
104
|
```
|
|
108
105
|
|
|
109
|
-
Save the program into `main.py`,
|
|
110
|
-
Visit `localhost:8000` in your browser
|
|
106
|
+
Save the program into `main.py`, edit `dbos-config.yaml` to configure your Postgres connection settings, and start it with `fastapi run`.
|
|
107
|
+
Visit `localhost:8000` in your browser to start the workflow.
|
|
111
108
|
When prompted, press `Control + \` to force quit your application.
|
|
112
109
|
It should crash midway through the workflow, having completed step one but not step two.
|
|
113
110
|
Then, restart your app with `fastapi run`.
|
|
114
111
|
It should resume the workflow from where it left off, completing step two without re-executing step one.
|
|
115
112
|
|
|
116
|
-
To learn how to build more complex
|
|
113
|
+
To learn how to build more complex workflows, see our [programming guide](https://docs.dbos.dev/python/programming-guide) or [examples](https://docs.dbos.dev/examples).
|
|
117
114
|
|
|
118
115
|
## Documentation
|
|
119
116
|
|
|
120
|
-
|
|
117
|
+
[https://docs.dbos.dev](https://docs.dbos.dev)
|
|
121
118
|
|
|
122
119
|
## Examples
|
|
123
120
|
|
|
124
|
-
|
|
121
|
+
|
|
122
|
+
- [**AI-Powered Slackbot**](https://docs.dbos.dev/python/examples/rag-slackbot) — A Slackbot that answers questions about previous Slack conversations, using DBOS to durably orchestrate its RAG pipeline.
|
|
123
|
+
- [**Widget Store**](https://docs.dbos.dev/python/examples/widget-store) — An online storefront that uses DBOS durable workflows to be resilient to any failure.
|
|
124
|
+
- [**Earthquake Tracker**](https://docs.dbos.dev/python/examples/earthquake-tracker) — A real-time earthquake dashboard that uses DBOS to stream data from the USGS into Postgres, then visualizes it with Streamlit.
|
|
125
|
+
|
|
126
|
+
More examples [here](https://docs.dbos.dev/examples)!
|
|
125
127
|
|
|
126
128
|
## Community
|
|
127
129
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
## 🚀 DBOS Transact - Ultra-Lightweight Durable Execution in Python 🚀
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
<div align="center">
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
# DBOS Transact: Ultra-Lightweight Durable Execution
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
#### [Documentation](https://docs.dbos.dev/) • [Examples](https://docs.dbos.dev/examples) • [Github](https://github.com/dbos-inc) • [Discord](https://discord.com/invite/jsmC6pXGgX)
|
|
7
|
+
</div>
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
**DBOS Python is under construction! 🚧🚧🚧 Check back regularly for updates, release coming in mid-September!**
|
|
13
|
-
|
|
14
|
-
DBOS Transact is a **Python library** providing ultra-lightweight durable execution.
|
|
11
|
+
DBOS Transact is a Python library providing **ultra-lightweight durable execution**.
|
|
15
12
|
For example:
|
|
16
13
|
|
|
17
14
|
```python
|
|
@@ -46,14 +43,14 @@ Some more cool features include:
|
|
|
46
43
|
|
|
47
44
|
## Getting Started
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
Install and configure with:
|
|
50
47
|
|
|
51
48
|
```shell
|
|
52
|
-
pip install
|
|
49
|
+
pip install dbos
|
|
53
50
|
dbos init --config
|
|
54
51
|
```
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
Then, try it out with this simple program (requires Postgres):
|
|
57
54
|
|
|
58
55
|
```python
|
|
59
56
|
from fastapi import FastAPI
|
|
@@ -83,22 +80,27 @@ def endpoint():
|
|
|
83
80
|
workflow()
|
|
84
81
|
```
|
|
85
82
|
|
|
86
|
-
Save the program into `main.py`,
|
|
87
|
-
Visit `localhost:8000` in your browser
|
|
83
|
+
Save the program into `main.py`, edit `dbos-config.yaml` to configure your Postgres connection settings, and start it with `fastapi run`.
|
|
84
|
+
Visit `localhost:8000` in your browser to start the workflow.
|
|
88
85
|
When prompted, press `Control + \` to force quit your application.
|
|
89
86
|
It should crash midway through the workflow, having completed step one but not step two.
|
|
90
87
|
Then, restart your app with `fastapi run`.
|
|
91
88
|
It should resume the workflow from where it left off, completing step two without re-executing step one.
|
|
92
89
|
|
|
93
|
-
To learn how to build more complex
|
|
90
|
+
To learn how to build more complex workflows, see our [programming guide](https://docs.dbos.dev/python/programming-guide) or [examples](https://docs.dbos.dev/examples).
|
|
94
91
|
|
|
95
92
|
## Documentation
|
|
96
93
|
|
|
97
|
-
|
|
94
|
+
[https://docs.dbos.dev](https://docs.dbos.dev)
|
|
98
95
|
|
|
99
96
|
## Examples
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
|
|
99
|
+
- [**AI-Powered Slackbot**](https://docs.dbos.dev/python/examples/rag-slackbot) — A Slackbot that answers questions about previous Slack conversations, using DBOS to durably orchestrate its RAG pipeline.
|
|
100
|
+
- [**Widget Store**](https://docs.dbos.dev/python/examples/widget-store) — An online storefront that uses DBOS durable workflows to be resilient to any failure.
|
|
101
|
+
- [**Earthquake Tracker**](https://docs.dbos.dev/python/examples/earthquake-tracker) — A real-time earthquake dashboard that uses DBOS to stream data from the USGS into Postgres, then visualizes it with Streamlit.
|
|
102
|
+
|
|
103
|
+
More examples [here](https://docs.dbos.dev/examples)!
|
|
102
104
|
|
|
103
105
|
## Community
|
|
104
106
|
|
|
@@ -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:
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# This is a sample app built with DBOS and FastAPI.
|
|
4
4
|
# It displays greetings to visitors and keeps track of how
|
|
5
|
-
# many times
|
|
5
|
+
# many times visitors have been greeted.
|
|
6
6
|
|
|
7
7
|
# First, let's do imports, create a FastAPI app, and initialize DBOS.
|
|
8
8
|
|
|
9
9
|
from fastapi import FastAPI
|
|
10
10
|
from fastapi.responses import HTMLResponse
|
|
11
|
-
from sqlalchemy.dialects.postgresql import insert
|
|
12
11
|
|
|
13
12
|
from dbos import DBOS
|
|
14
13
|
|
|
@@ -19,33 +18,26 @@ DBOS(fastapi=app)
|
|
|
19
18
|
|
|
20
19
|
# Next, let's write a function that greets visitors.
|
|
21
20
|
# To make it more interesting, we'll keep track of how
|
|
22
|
-
# many times
|
|
21
|
+
# many times visitors have been greeted and store
|
|
23
22
|
# the count in the database.
|
|
24
23
|
|
|
25
|
-
# We
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
24
|
+
# We implement the database operations using SQLAlchemy
|
|
25
|
+
# and serve the function from a FastAPI endpoint.
|
|
26
|
+
# We annotate it with @DBOS.transaction() to access
|
|
27
|
+
# an automatically-configured database client.
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
@app.get("/greeting/{name}")
|
|
32
31
|
@DBOS.transaction()
|
|
33
32
|
def example_transaction(name: str) -> str:
|
|
34
|
-
query = (
|
|
35
|
-
insert(dbos_hello)
|
|
36
|
-
.values(name="dbos", greet_count=1)
|
|
37
|
-
.on_conflict_do_update(
|
|
38
|
-
index_elements=["name"], set_={"greet_count": dbos_hello.c.greet_count + 1}
|
|
39
|
-
)
|
|
40
|
-
.returning(dbos_hello.c.greet_count)
|
|
41
|
-
)
|
|
33
|
+
query = dbos_hello.insert().values(name=name).returning(dbos_hello.c.greet_count)
|
|
42
34
|
greet_count = DBOS.sql_session.execute(query).scalar_one()
|
|
43
35
|
greeting = f"Greetings, {name}! You have been greeted {greet_count} times."
|
|
44
36
|
DBOS.logger.info(greeting)
|
|
45
37
|
return greeting
|
|
46
38
|
|
|
47
39
|
|
|
48
|
-
# Finally, let's use FastAPI to serve
|
|
40
|
+
# Finally, let's use FastAPI to serve an HTML + CSS readme
|
|
49
41
|
# from the root path.
|
|
50
42
|
|
|
51
43
|
|
|
@@ -74,13 +66,14 @@ def readme() -> HTMLResponse:
|
|
|
74
66
|
return HTMLResponse(readme)
|
|
75
67
|
|
|
76
68
|
|
|
77
|
-
# To run this app locally:
|
|
78
|
-
# - Make sure you have a Postgres database to connect
|
|
79
|
-
# - "dbos migrate" to set up your database tables
|
|
80
|
-
# - "dbos start" to start the app
|
|
81
|
-
# - Visit localhost:8000 to see your app!
|
|
82
|
-
|
|
83
69
|
# To deploy this app to DBOS Cloud:
|
|
84
70
|
# - "npm i -g @dbos-inc/dbos-cloud@latest" to install the Cloud CLI (requires Node)
|
|
85
71
|
# - "dbos-cloud app deploy" to deploy your app
|
|
86
72
|
# - Deploy outputs a URL--visit it to see your app!
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# To run this app locally:
|
|
76
|
+
# - Make sure you have a Postgres database to connect to
|
|
77
|
+
# - "dbos migrate" to set up your database tables
|
|
78
|
+
# - "dbos start" to start the app
|
|
79
|
+
# - Visit localhost:8000 to see your app!
|
|
@@ -5,6 +5,6 @@ metadata = MetaData()
|
|
|
5
5
|
dbos_hello = Table(
|
|
6
6
|
"dbos_hello",
|
|
7
7
|
metadata,
|
|
8
|
-
Column("
|
|
9
|
-
Column("
|
|
8
|
+
Column("greet_count", Integer, primary_key=True, autoincrement=True),
|
|
9
|
+
Column("name", String, nullable=False),
|
|
10
10
|
)
|
{dbos-0.6.0a0 → dbos-0.6.0a4}/dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py
RENAMED
|
@@ -22,9 +22,9 @@ def upgrade() -> None:
|
|
|
22
22
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
23
|
op.create_table(
|
|
24
24
|
"dbos_hello",
|
|
25
|
+
sa.Column("greet_count", sa.Integer(), autoincrement=True, nullable=False),
|
|
25
26
|
sa.Column("name", sa.String(), nullable=False),
|
|
26
|
-
sa.
|
|
27
|
-
sa.PrimaryKeyConstraint("name"),
|
|
27
|
+
sa.PrimaryKeyConstraint("greet_count"),
|
|
28
28
|
)
|
|
29
29
|
# ### end Alembic commands ###
|
|
30
30
|
|
|
@@ -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
|
|
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
|