test_parent_run_id_assignment() — langchain Function Reference
Architecture documentation for the test_parent_run_id_assignment() function in test_runnable_events_v2.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b76f69cc_1eea_9446_3678_546201ac53b8["test_parent_run_id_assignment()"] 33c02978_2077_5819_7048_bc2a81e80625["test_runnable_events_v2.py"] b76f69cc_1eea_9446_3678_546201ac53b8 -->|defined in| 33c02978_2077_5819_7048_bc2a81e80625 716d2a5e_dc8e_3cae_e044_b56b06bee655["_collect_events()"] b76f69cc_1eea_9446_3678_546201ac53b8 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655 style b76f69cc_1eea_9446_3678_546201ac53b8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py lines 2244–2339
async def test_parent_run_id_assignment() -> None:
"""Test assignment of parent run id."""
@RunnableLambda
async def grandchild(x: str) -> str:
return x
@RunnableLambda[str, str]
async def child(x: str, config: RunnableConfig) -> str:
config["run_id"] = uuid.UUID(int=9)
return await grandchild.ainvoke(x, config)
@RunnableLambda[str, str]
async def parent(x: str, config: RunnableConfig) -> str:
config["run_id"] = uuid.UUID(int=8)
return await child.ainvoke(x, config)
bond = uuid.UUID(int=7)
events = await _collect_events(
parent.astream_events("hello", {"run_id": bond}, version="v2"),
with_nulled_ids=False,
)
_assert_events_equal_allow_superset_metadata(
events,
[
{
"data": {"input": "hello"},
"event": "on_chain_start",
"metadata": {},
"name": "parent",
"parent_ids": [],
"run_id": "00000000-0000-0000-0000-000000000007",
"tags": [],
},
{
"data": {"input": "hello"},
"event": "on_chain_start",
"metadata": {},
"name": "child",
"parent_ids": ["00000000-0000-0000-0000-000000000007"],
"run_id": "00000000-0000-0000-0000-000000000008",
"tags": [],
},
{
"data": {"input": "hello"},
"event": "on_chain_start",
"metadata": {},
"name": "grandchild",
"parent_ids": [
"00000000-0000-0000-0000-000000000007",
"00000000-0000-0000-0000-000000000008",
],
"run_id": "00000000-0000-0000-0000-000000000009",
"tags": [],
},
{
"data": {"input": "hello", "output": "hello"},
"event": "on_chain_end",
"metadata": {},
"name": "grandchild",
"parent_ids": [
"00000000-0000-0000-0000-000000000007",
"00000000-0000-0000-0000-000000000008",
],
"run_id": "00000000-0000-0000-0000-000000000009",
"tags": [],
},
{
"data": {"input": "hello", "output": "hello"},
"event": "on_chain_end",
"metadata": {},
"name": "child",
"parent_ids": ["00000000-0000-0000-0000-000000000007"],
"run_id": "00000000-0000-0000-0000-000000000008",
"tags": [],
},
{
"data": {"chunk": "hello"},
"event": "on_chain_stream",
"metadata": {},
"name": "parent",
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_parent_run_id_assignment() do?
test_parent_run_id_assignment() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py.
Where is test_parent_run_id_assignment() defined?
test_parent_run_id_assignment() is defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py at line 2244.
What does test_parent_run_id_assignment() call?
test_parent_run_id_assignment() calls 1 function(s): _collect_events.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free