From 8c81765bccce9e18a654a09b274398c8dc058add Mon Sep 17 00:00:00 2001 From: Dylan Mikus Date: Fri, 25 Apr 2025 15:12:45 -0400 Subject: [PATCH 1/2] Add error message to assertion exception When asserting that the creation of a new workflow occurs outside a step, add a human-readable error message to the assertion. --- dbos/_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbos/_core.py b/dbos/_core.py index 1d14c14f..a741adee 100644 --- a/dbos/_core.py +++ b/dbos/_core.py @@ -492,7 +492,7 @@ def _get_new_wf() -> tuple[str, DBOSContext]: # Pass the new context to a worker thread that will run the wf function cur_ctx = get_local_dbos_context() if cur_ctx is not None and cur_ctx.is_within_workflow(): - assert cur_ctx.is_workflow() # Not in a step + assert cur_ctx.is_workflow(), "Not in a step" # Not in a step cur_ctx.function_id += 1 if len(cur_ctx.id_assigned_for_next_workflow) == 0: cur_ctx.id_assigned_for_next_workflow = ( From 13e6996158bc7e156317f88752d32c507d9684b4 Mon Sep 17 00:00:00 2001 From: Dylan Mikus Date: Fri, 25 Apr 2025 15:13:34 -0400 Subject: [PATCH 2/2] Child workflows inherit Opentelemetry parent spans --- dbos/_context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dbos/_context.py b/dbos/_context.py index 7dc874e8..1fd3038b 100644 --- a/dbos/_context.py +++ b/dbos/_context.py @@ -117,6 +117,7 @@ def create_child(self) -> DBOSContext: ) rv.request = self.request rv.assumed_role = self.assumed_role + rv.spans = list(self.spans) return rv def has_parent(self) -> bool: