dbos 0.26.0a0__py3-none-any.whl → 0.26.0a3__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/_admin_server.py +7 -1
- dbos/_client.py +2 -4
- dbos/_dbos_config.py +30 -3
- dbos/dbos-config.schema.json +1 -1
- {dbos-0.26.0a0.dist-info → dbos-0.26.0a3.dist-info}/METADATA +1 -1
- {dbos-0.26.0a0.dist-info → dbos-0.26.0a3.dist-info}/RECORD +9 -9
- {dbos-0.26.0a0.dist-info → dbos-0.26.0a3.dist-info}/WHEEL +0 -0
- {dbos-0.26.0a0.dist-info → dbos-0.26.0a3.dist-info}/entry_points.txt +0 -0
- {dbos-0.26.0a0.dist-info → dbos-0.26.0a3.dist-info}/licenses/LICENSE +0 -0
dbos/_admin_server.py
CHANGED
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, Any, List, TypedDict
|
|
9
9
|
|
10
10
|
from ._logger import dbos_logger
|
11
11
|
from ._recovery import recover_pending_workflows
|
12
|
+
from ._utils import GlobalParams
|
12
13
|
|
13
14
|
if TYPE_CHECKING:
|
14
15
|
from ._dbos import DBOS
|
@@ -44,6 +45,7 @@ class AdminServer:
|
|
44
45
|
class AdminRequestHandler(BaseHTTPRequestHandler):
|
45
46
|
def __init__(self, dbos: DBOS, *args: Any, **kwargs: Any) -> None:
|
46
47
|
self.dbos = dbos
|
48
|
+
self.is_deactivated = False
|
47
49
|
super().__init__(*args, **kwargs)
|
48
50
|
|
49
51
|
def _end_headers(self) -> None:
|
@@ -59,10 +61,14 @@ class AdminRequestHandler(BaseHTTPRequestHandler):
|
|
59
61
|
self._end_headers()
|
60
62
|
self.wfile.write("healthy".encode("utf-8"))
|
61
63
|
elif self.path == _deactivate_path:
|
64
|
+
if not self.is_deactivated:
|
65
|
+
dbos_logger.info(
|
66
|
+
f"Deactivating DBOS executor {GlobalParams.executor_id} with version {GlobalParams.app_version}. This executor will complete existing workflows but will not start new workflows."
|
67
|
+
)
|
68
|
+
self.is_deactivated = True
|
62
69
|
# Stop all scheduled workflows, queues, and kafka loops
|
63
70
|
for event in self.dbos.stop_events:
|
64
71
|
event.set()
|
65
|
-
|
66
72
|
self.send_response(200)
|
67
73
|
self._end_headers()
|
68
74
|
self.wfile.write("deactivated".encode("utf-8"))
|
dbos/_client.py
CHANGED
@@ -22,10 +22,9 @@ R = TypeVar("R", covariant=True) # A generic type for workflow return values
|
|
22
22
|
|
23
23
|
class EnqueueOptions(TypedDict):
|
24
24
|
workflow_name: str
|
25
|
-
workflow_class_name: NotRequired[str]
|
26
25
|
queue_name: str
|
27
|
-
app_version: NotRequired[str]
|
28
26
|
workflow_id: NotRequired[str]
|
27
|
+
app_version: NotRequired[str]
|
29
28
|
|
30
29
|
|
31
30
|
class WorkflowHandleClientPolling(Generic[R]):
|
@@ -86,7 +85,6 @@ class DBOSClient:
|
|
86
85
|
workflow_name = options["workflow_name"]
|
87
86
|
queue_name = options["queue_name"]
|
88
87
|
|
89
|
-
workflow_class_name = options.get("workflow_class_name")
|
90
88
|
app_version = options.get("app_version")
|
91
89
|
max_recovery_attempts = options.get("max_recovery_attempts")
|
92
90
|
if max_recovery_attempts is None:
|
@@ -99,7 +97,7 @@ class DBOSClient:
|
|
99
97
|
"workflow_uuid": workflow_id,
|
100
98
|
"status": WorkflowStatusString.ENQUEUED.value,
|
101
99
|
"name": workflow_name,
|
102
|
-
"class_name":
|
100
|
+
"class_name": None,
|
103
101
|
"queue_name": queue_name,
|
104
102
|
"app_version": app_version,
|
105
103
|
"config_name": None,
|
dbos/_dbos_config.py
CHANGED
@@ -215,9 +215,13 @@ def translate_dbos_config_to_config_file(config: DBOSConfig) -> ConfigFile:
|
|
215
215
|
|
216
216
|
|
217
217
|
def _substitute_env_vars(content: str, silent: bool = False) -> str:
|
218
|
-
regex = r"\$\{([^}]+)\}" # Regex to match ${VAR_NAME} style placeholders
|
219
218
|
|
220
|
-
|
219
|
+
# Regex to match ${DOCKER_SECRET:SECRET_NAME} style placeholders for Docker secrets
|
220
|
+
secret_regex = r"\$\{DOCKER_SECRET:([^}]+)\}"
|
221
|
+
# Regex to match ${VAR_NAME} style placeholders for environment variables
|
222
|
+
env_regex = r"\$\{(?!DOCKER_SECRET:)([^}]+)\}"
|
223
|
+
|
224
|
+
def replace_env_func(match: re.Match[str]) -> str:
|
221
225
|
var_name = match.group(1)
|
222
226
|
value = os.environ.get(
|
223
227
|
var_name, ""
|
@@ -228,7 +232,30 @@ def _substitute_env_vars(content: str, silent: bool = False) -> str:
|
|
228
232
|
)
|
229
233
|
return value
|
230
234
|
|
231
|
-
|
235
|
+
def replace_secret_func(match: re.Match[str]) -> str:
|
236
|
+
secret_name = match.group(1)
|
237
|
+
try:
|
238
|
+
# Docker secrets are stored in /run/secrets/
|
239
|
+
secret_path = f"/run/secrets/{secret_name}"
|
240
|
+
if os.path.exists(secret_path):
|
241
|
+
with open(secret_path, "r") as f:
|
242
|
+
return f.read().strip()
|
243
|
+
elif not silent:
|
244
|
+
dbos_logger.warning(
|
245
|
+
f"Docker secret {secret_name} would be substituted from /run/secrets/{secret_name}, but the file does not exist"
|
246
|
+
)
|
247
|
+
return ""
|
248
|
+
except Exception as e:
|
249
|
+
if not silent:
|
250
|
+
dbos_logger.warning(
|
251
|
+
f"Error reading Docker secret {secret_name}: {str(e)}"
|
252
|
+
)
|
253
|
+
return ""
|
254
|
+
|
255
|
+
# First replace Docker secrets
|
256
|
+
content = re.sub(secret_regex, replace_secret_func, content)
|
257
|
+
# Then replace environment variables
|
258
|
+
return re.sub(env_regex, replace_env_func, content)
|
232
259
|
|
233
260
|
|
234
261
|
def get_dbos_database_url(config_file_path: str = DBOS_CONFIG_PATH) -> str:
|
dbos/dbos-config.schema.json
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
},
|
41
41
|
"password": {
|
42
42
|
"type": ["string", "null"],
|
43
|
-
"description": "The password to use when connecting to the application database. Developers are strongly encouraged to use environment variable substitution to avoid storing secrets in source."
|
43
|
+
"description": "The password to use when connecting to the application database. Developers are strongly encouraged to use environment variable substitution (${VAR_NAME}) or Docker secrets (${DOCKER_SECRET:SECRET_NAME}) to avoid storing secrets in source."
|
44
44
|
},
|
45
45
|
"connectionTimeoutMillis": {
|
46
46
|
"type": "number",
|
@@ -1,13 +1,13 @@
|
|
1
|
-
dbos-0.26.
|
2
|
-
dbos-0.26.
|
3
|
-
dbos-0.26.
|
4
|
-
dbos-0.26.
|
1
|
+
dbos-0.26.0a3.dist-info/METADATA,sha256=0Mkwde0BUtfYGHbfTxX_86tO7W6B_r2SqJktrNul4b0,5553
|
2
|
+
dbos-0.26.0a3.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
dbos-0.26.0a3.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-0.26.0a3.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
5
5
|
dbos/__init__.py,sha256=3NQfGlBiiUSM_v88STdVP3rNZvGkUL_9WbSotKb8Voo,873
|
6
6
|
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
7
|
-
dbos/_admin_server.py,sha256=
|
7
|
+
dbos/_admin_server.py,sha256=vxPG_YJ6lYrkfPCSp42FiATVLBOij7Fm52Yngg5Z_tE,7027
|
8
8
|
dbos/_app_db.py,sha256=R3sbh--84A4i-dTz8IXYmxO4b4s5VSwiPQvi_le52mg,6109
|
9
9
|
dbos/_classproperty.py,sha256=f0X-_BySzn3yFDRKB2JpCbLYQ9tLwt1XftfshvY7CBs,626
|
10
|
-
dbos/_client.py,sha256=
|
10
|
+
dbos/_client.py,sha256=fzW_Gagh-oyWyDYtREcQDBesoVl_LsEoMeJAsn5-C5s,7262
|
11
11
|
dbos/_cloudutils/authentication.py,sha256=V0fCWQN9stCkhbuuxgPTGpvuQcDqfU3KAxPAh01vKW4,5007
|
12
12
|
dbos/_cloudutils/cloudutils.py,sha256=YC7jGsIopT0KveLsqbRpQk2KlRBk-nIRC_UCgep4f3o,7797
|
13
13
|
dbos/_cloudutils/databases.py,sha256=_shqaqSvhY4n2ScgQ8IP5PDZvzvcx3YBKV8fj-cxhSY,8543
|
@@ -18,7 +18,7 @@ dbos/_core.py,sha256=kIj_4wlIff8ptlACJKXAPSNoyJIt2h44swjMKxfwv0k,45789
|
|
18
18
|
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
19
19
|
dbos/_db_wizard.py,sha256=VnMa6OL87Lc-XPDD1RnXp8NjsJE8YgiQLj3wtWAXp-8,8252
|
20
20
|
dbos/_dbos.py,sha256=AKfB61vvz5shPoEpKxqrqoiDemintKMqyBxhESRRJE8,45231
|
21
|
-
dbos/_dbos_config.py,sha256=
|
21
|
+
dbos/_dbos_config.py,sha256=rTn30Hgh-RzTxqHbnYh2pC3Ioo30eJV9K4YxhJd-Gj4,22718
|
22
22
|
dbos/_debug.py,sha256=mmgvLkqlrljMBBow9wk01PPur9kUf2rI_11dTJXY4gw,1822
|
23
23
|
dbos/_error.py,sha256=B6Y9XLS1f6yrawxB2uAEYFMxFwk9BHhdxPNddKco-Fw,5399
|
24
24
|
dbos/_fastapi.py,sha256=PhaKftbApHnjtYEOw0EYna_3K0cmz__J9of7mRJWzu4,3704
|
@@ -64,7 +64,7 @@ dbos/_workflow_commands.py,sha256=SYp2khc9RSf6tjllG9CqT1zjBQnFTFq33ePXpvmRwME,58
|
|
64
64
|
dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
|
65
65
|
dbos/cli/_template_init.py,sha256=-WW3kbq0W_Tq4WbMqb1UGJG3xvJb3woEY5VspG95Srk,2857
|
66
66
|
dbos/cli/cli.py,sha256=G55sZJxfmvUGvWr0hoIWwVZBy-fJdpCsTsZmuHT1CjA,16049
|
67
|
-
dbos/dbos-config.schema.json,sha256=
|
67
|
+
dbos/dbos-config.schema.json,sha256=4z2OXPfp7H0uNT1m5dKxjg31qbAfPyKkFXwHufuUMec,5910
|
68
68
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
69
69
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
70
|
-
dbos-0.26.
|
70
|
+
dbos-0.26.0a3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|