dbos 1.6.0a4__py3-none-any.whl → 1.7.0a2__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 +17 -8
- dbos/_context.py +5 -11
- dbos/_core.py +0 -5
- dbos/_dbos.py +11 -1
- {dbos-1.6.0a4.dist-info → dbos-1.7.0a2.dist-info}/METADATA +1 -1
- {dbos-1.6.0a4.dist-info → dbos-1.7.0a2.dist-info}/RECORD +9 -9
- {dbos-1.6.0a4.dist-info → dbos-1.7.0a2.dist-info}/WHEEL +0 -0
- {dbos-1.6.0a4.dist-info → dbos-1.7.0a2.dist-info}/entry_points.txt +0 -0
- {dbos-1.6.0a4.dist-info → dbos-1.7.0a2.dist-info}/licenses/LICENSE +0 -0
dbos/_admin_server.py
CHANGED
@@ -3,12 +3,14 @@ from __future__ import annotations
|
|
3
3
|
import json
|
4
4
|
import re
|
5
5
|
import threading
|
6
|
+
from dataclasses import asdict
|
6
7
|
from functools import partial
|
7
8
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
8
9
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, TypedDict
|
9
10
|
|
10
11
|
from dbos._workflow_commands import garbage_collect, global_timeout
|
11
12
|
|
13
|
+
from ._conductor import protocol as conductor_protocol
|
12
14
|
from ._context import SetWorkflowID
|
13
15
|
from ._error import DBOSException
|
14
16
|
from ._logger import dbos_logger
|
@@ -326,20 +328,24 @@ class AdminRequestHandler(BaseHTTPRequestHandler):
|
|
326
328
|
|
327
329
|
def _handle_workflows(self, filters: Dict[str, Any]) -> None:
|
328
330
|
workflows = self.dbos.list_workflows(
|
329
|
-
workflow_ids=filters.get("
|
330
|
-
|
331
|
+
workflow_ids=filters.get("workflow_uuids"),
|
332
|
+
user=filters.get("authenticated_user"),
|
331
333
|
start_time=filters.get("start_time"),
|
332
334
|
end_time=filters.get("end_time"),
|
333
335
|
status=filters.get("status"),
|
334
336
|
app_version=filters.get("application_version"),
|
337
|
+
name=filters.get("workflow_name"),
|
335
338
|
limit=filters.get("limit"),
|
336
339
|
offset=filters.get("offset"),
|
337
340
|
sort_desc=filters.get("sort_desc", False),
|
338
341
|
workflow_id_prefix=filters.get("workflow_id_prefix"),
|
339
342
|
)
|
340
|
-
|
343
|
+
workflows_output = [
|
344
|
+
conductor_protocol.WorkflowsOutput.from_workflow_information(i)
|
345
|
+
for i in workflows
|
346
|
+
]
|
341
347
|
response_body = json.dumps(
|
342
|
-
[workflow.__dict__ for workflow in
|
348
|
+
[workflow.__dict__ for workflow in workflows_output]
|
343
349
|
).encode("utf-8")
|
344
350
|
self.send_response(200)
|
345
351
|
self.send_header("Content-Type", "application/json")
|
@@ -349,18 +355,21 @@ class AdminRequestHandler(BaseHTTPRequestHandler):
|
|
349
355
|
|
350
356
|
def _handle_queued_workflows(self, filters: Dict[str, Any]) -> None:
|
351
357
|
workflows = self.dbos.list_queued_workflows(
|
352
|
-
queue_name=filters.get("queue_name"),
|
353
|
-
name=filters.get("name"),
|
354
358
|
start_time=filters.get("start_time"),
|
355
359
|
end_time=filters.get("end_time"),
|
356
360
|
status=filters.get("status"),
|
361
|
+
name=filters.get("workflow_name"),
|
357
362
|
limit=filters.get("limit"),
|
358
363
|
offset=filters.get("offset"),
|
364
|
+
queue_name=filters.get("queue_name"),
|
359
365
|
sort_desc=filters.get("sort_desc", False),
|
360
366
|
)
|
361
|
-
|
367
|
+
workflows_output = [
|
368
|
+
conductor_protocol.WorkflowsOutput.from_workflow_information(i)
|
369
|
+
for i in workflows
|
370
|
+
]
|
362
371
|
response_body = json.dumps(
|
363
|
-
[workflow.__dict__ for workflow in
|
372
|
+
[workflow.__dict__ for workflow in workflows_output]
|
364
373
|
).encode("utf-8")
|
365
374
|
self.send_response(200)
|
366
375
|
self.send_header("Content-Type", "application/json")
|
dbos/_context.py
CHANGED
@@ -140,23 +140,18 @@ class DBOSContext:
|
|
140
140
|
self,
|
141
141
|
wfid: Optional[str],
|
142
142
|
attributes: TracedAttributes,
|
143
|
-
is_temp_workflow: bool = False,
|
144
143
|
) -> None:
|
145
144
|
if wfid is None or len(wfid) == 0:
|
146
145
|
wfid = self.assign_workflow_id()
|
147
146
|
self.id_assigned_for_next_workflow = ""
|
148
147
|
self.workflow_id = wfid
|
149
148
|
self.function_id = 0
|
150
|
-
|
151
|
-
self._start_span(attributes)
|
149
|
+
self._start_span(attributes)
|
152
150
|
|
153
|
-
def end_workflow(
|
154
|
-
self, exc_value: Optional[BaseException], is_temp_workflow: bool = False
|
155
|
-
) -> None:
|
151
|
+
def end_workflow(self, exc_value: Optional[BaseException]) -> None:
|
156
152
|
self.workflow_id = ""
|
157
153
|
self.function_id = -1
|
158
|
-
|
159
|
-
self._end_span(exc_value)
|
154
|
+
self._end_span(exc_value)
|
160
155
|
|
161
156
|
def is_within_workflow(self) -> bool:
|
162
157
|
return len(self.workflow_id) > 0
|
@@ -490,7 +485,6 @@ class EnterDBOSWorkflow(AbstractContextManager[DBOSContext, Literal[False]]):
|
|
490
485
|
def __init__(self, attributes: TracedAttributes) -> None:
|
491
486
|
self.created_ctx = False
|
492
487
|
self.attributes = attributes
|
493
|
-
self.is_temp_workflow = attributes["name"] == "temp_wf"
|
494
488
|
self.saved_workflow_timeout: Optional[int] = None
|
495
489
|
self.saved_deduplication_id: Optional[str] = None
|
496
490
|
self.saved_priority: Optional[int] = None
|
@@ -514,7 +508,7 @@ class EnterDBOSWorkflow(AbstractContextManager[DBOSContext, Literal[False]]):
|
|
514
508
|
self.saved_priority = ctx.priority
|
515
509
|
ctx.priority = None
|
516
510
|
ctx.start_workflow(
|
517
|
-
None, self.attributes
|
511
|
+
None, self.attributes
|
518
512
|
) # Will get from the context's next workflow ID
|
519
513
|
return ctx
|
520
514
|
|
@@ -526,7 +520,7 @@ class EnterDBOSWorkflow(AbstractContextManager[DBOSContext, Literal[False]]):
|
|
526
520
|
) -> Literal[False]:
|
527
521
|
ctx = assert_current_dbos_context()
|
528
522
|
assert ctx.is_within_workflow()
|
529
|
-
ctx.end_workflow(exc_value
|
523
|
+
ctx.end_workflow(exc_value)
|
530
524
|
# Restore the saved workflow timeout
|
531
525
|
ctx.workflow_timeout_ms = self.saved_workflow_timeout
|
532
526
|
# Clear any propagating timeout
|
dbos/_core.py
CHANGED
@@ -1187,11 +1187,6 @@ def decorate_step(
|
|
1187
1187
|
async def temp_wf_async(*args: Any, **kwargs: Any) -> Any:
|
1188
1188
|
return await wrapper(*args, **kwargs)
|
1189
1189
|
|
1190
|
-
# Other code in transact-py depends on the name of temporary workflow functions to be "temp_wf"
|
1191
|
-
# so set the name of both sync and async temporary workflow functions explicitly
|
1192
|
-
temp_wf_sync.__name__ = "temp_wf"
|
1193
|
-
temp_wf_async.__name__ = "temp_wf"
|
1194
|
-
|
1195
1190
|
temp_wf = temp_wf_async if inspect.iscoroutinefunction(func) else temp_wf_sync
|
1196
1191
|
wrapped_wf = workflow_wrapper(dbosreg, temp_wf)
|
1197
1192
|
set_dbos_func_name(temp_wf, "<temp>." + step_name)
|
dbos/_dbos.py
CHANGED
@@ -7,7 +7,6 @@ import inspect
|
|
7
7
|
import os
|
8
8
|
import sys
|
9
9
|
import threading
|
10
|
-
import traceback
|
11
10
|
import uuid
|
12
11
|
from concurrent.futures import ThreadPoolExecutor
|
13
12
|
from logging import Logger
|
@@ -28,6 +27,7 @@ from typing import (
|
|
28
27
|
)
|
29
28
|
|
30
29
|
from opentelemetry.trace import Span
|
30
|
+
from rich import print
|
31
31
|
|
32
32
|
from dbos._conductor.conductor import ConductorWebsocket
|
33
33
|
from dbos._sys_db import WorkflowStatus
|
@@ -517,6 +517,16 @@ class DBOS:
|
|
517
517
|
|
518
518
|
dbos_logger.info("DBOS launched!")
|
519
519
|
|
520
|
+
if self.conductor_key is None and os.environ.get("DBOS__CLOUD") != "true":
|
521
|
+
# Hint the user to open the URL to register and set up Conductor
|
522
|
+
app_name = self._config["name"]
|
523
|
+
conductor_registration_url = (
|
524
|
+
f"https://console.dbos.dev/self-host?appname={app_name}"
|
525
|
+
)
|
526
|
+
print(
|
527
|
+
f"[bold]To view and manage workflows, connect to DBOS Conductor at:[/bold] [bold blue]{conductor_registration_url}[/bold blue]"
|
528
|
+
)
|
529
|
+
|
520
530
|
# Flush handlers and add OTLP to all loggers if enabled
|
521
531
|
# to enable their export in DBOS Cloud
|
522
532
|
for handler in dbos_logger.handlers:
|
@@ -1,19 +1,19 @@
|
|
1
|
-
dbos-1.
|
2
|
-
dbos-1.
|
3
|
-
dbos-1.
|
4
|
-
dbos-1.
|
1
|
+
dbos-1.7.0a2.dist-info/METADATA,sha256=cv0iRmtSfwgBhECvLi62ErKrKa0hbM4KW2YPX3UL4-A,13267
|
2
|
+
dbos-1.7.0a2.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
dbos-1.7.0a2.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-1.7.0a2.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
5
5
|
dbos/__init__.py,sha256=NssPCubaBxdiKarOWa-wViz1hdJSkmBGcpLX_gQ4NeA,891
|
6
6
|
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
7
|
-
dbos/_admin_server.py,sha256=
|
7
|
+
dbos/_admin_server.py,sha256=86rL_aQmmi_zZ4a7PGVNbF6ey9tP27WC1wazQedFLWo,15927
|
8
8
|
dbos/_app_db.py,sha256=htblDPfqrpb_uZoFcvaud7cgQ-PDyn6Bn-cBidxdCTA,10603
|
9
9
|
dbos/_classproperty.py,sha256=f0X-_BySzn3yFDRKB2JpCbLYQ9tLwt1XftfshvY7CBs,626
|
10
10
|
dbos/_client.py,sha256=DeiJHo5fTedWsipr7qlQQIcDmVAPjzzX94X01121oQM,14780
|
11
11
|
dbos/_conductor/conductor.py,sha256=y_T-8kEHwKWt6W8LtcFMctB_6EvYFWsuGLxiFuuKKBU,23702
|
12
12
|
dbos/_conductor/protocol.py,sha256=DOTprPSd7oHDcvwWSyZpnlPds_JfILtcKzHZa-qBsF4,7330
|
13
|
-
dbos/_context.py,sha256=
|
14
|
-
dbos/_core.py,sha256=
|
13
|
+
dbos/_context.py,sha256=zhje6jObpBcRALYfHyyIEumHtk_enl_PxLl01j4oDME,24897
|
14
|
+
dbos/_core.py,sha256=m3e1WZ_210p2DT8c1sTh4S_CVM748UjkBdiGO846mVg,49269
|
15
15
|
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
16
|
-
dbos/_dbos.py,sha256=
|
16
|
+
dbos/_dbos.py,sha256=BprKIGPT-QDeoxtKM6kjRUK9dyF8sPCFfHIyIt0u7CE,48142
|
17
17
|
dbos/_dbos_config.py,sha256=JUG4V1rrP0p1AYESgih4ea80qOH_13UsgoIIm8X84pw,20562
|
18
18
|
dbos/_debug.py,sha256=99j2SChWmCPAlZoDmjsJGe77tpU2LEa8E2TtLAnnh7o,1831
|
19
19
|
dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
|
@@ -69,4 +69,4 @@ dbos/cli/cli.py,sha256=IcfaX4rrSrk6f24S2jrlR33snYMyNyEIx_lNQtuVr2E,22081
|
|
69
69
|
dbos/dbos-config.schema.json,sha256=CjaspeYmOkx6Ip_pcxtmfXJTn_YGdSx_0pcPBF7KZmo,6060
|
70
70
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
71
71
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
72
|
-
dbos-1.
|
72
|
+
dbos-1.7.0a2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|