Merge pull request #448 from langchain-ai/nc/14may/debug-output-include-task-idx-in-task-id

debug: Include task index in task id
This commit is contained in:
Nuno Campos
2024-05-14 13:38:02 -07:00
committed by GitHub
3 changed files with 60 additions and 36 deletions
+4 -4
View File
@@ -64,7 +64,7 @@ def map_debug_tasks(
step: int, tasks: list[PregelExecutableTask]
) -> Iterator[DebugOutputTask]:
ts = datetime.now(timezone.utc).isoformat()
for name, input, _, _, config, triggers in tasks:
for idx, (name, input, _, _, config, triggers) in enumerate(tasks):
if config is not None and TAG_HIDDEN in config.get("tags", []):
continue
@@ -73,7 +73,7 @@ def map_debug_tasks(
"timestamp": ts,
"step": step,
"payload": {
"id": str(uuid5(TASK_NAMESPACE, json.dumps((name, step)))),
"id": str(uuid5(TASK_NAMESPACE, json.dumps((name, step, idx)))),
"name": name,
"input": input,
"triggers": triggers,
@@ -87,7 +87,7 @@ def map_debug_task_results(
stream_channels_list: Sequence[str],
) -> Iterator[DebugOutputTaskResult]:
ts = datetime.now(timezone.utc).isoformat()
for name, _, _, writes, config, _ in tasks:
for idx, (name, _, _, writes, config, _) in enumerate(tasks):
if config is not None and TAG_HIDDEN in config.get("tags", []):
continue
@@ -96,7 +96,7 @@ def map_debug_task_results(
"timestamp": ts,
"step": step,
"payload": {
"id": str(uuid5(TASK_NAMESPACE, json.dumps((name, step)))),
"id": str(uuid5(TASK_NAMESPACE, json.dumps((name, step, idx)))),
"name": name,
"result": [w for w in writes if w[0] in stream_channels_list],
},
+28 -16
View File
@@ -501,7 +501,7 @@ def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "7a3cc398-2e02-5023-ad7b-e4848d3b67fa",
"id": "9379da35-ae1c-5a7b-8556-7ce22a1f8fde",
"name": "one",
"input": 2,
"triggers": ["input"],
@@ -512,7 +512,7 @@ def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "34e90af0-f97e-54e0-a159-691da37f175f",
"id": "49ac8f60-4ff2-5cdd-a319-66bbd9837e5a",
"name": "two",
"input": [12],
"triggers": ["inbox"],
@@ -523,7 +523,7 @@ def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "7a3cc398-2e02-5023-ad7b-e4848d3b67fa",
"id": "9379da35-ae1c-5a7b-8556-7ce22a1f8fde",
"name": "one",
"result": [("inbox", 3)],
},
@@ -533,7 +533,7 @@ def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "34e90af0-f97e-54e0-a159-691da37f175f",
"id": "49ac8f60-4ff2-5cdd-a319-66bbd9837e5a",
"name": "two",
"result": [("output", 13)],
},
@@ -549,7 +549,7 @@ def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "cf7cf374-2a2a-556f-8561-91737af89d2f",
"id": "b97f26c1-a34b-51e0-884e-44a41a3a3b47",
"name": "two",
"input": [3],
"triggers": ["inbox"],
@@ -560,7 +560,7 @@ def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "cf7cf374-2a2a-556f-8561-91737af89d2f",
"id": "b97f26c1-a34b-51e0-884e-44a41a3a3b47",
"name": "two",
"result": [("output", 4)],
},
@@ -4130,7 +4130,10 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"step": 0,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {"my_key": "value", "market": "DE"},
},
@@ -4140,7 +4143,7 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "e7879e70-6335-5867-9ec6-957fbb3da6fa",
"id": "d6e87693-41fb-58f5-8e0d-ee9ab46890b5",
"name": "prepare",
"input": {"my_key": "value", "market": "DE"},
"triggers": ["start:prepare"],
@@ -4151,7 +4154,7 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "e7879e70-6335-5867-9ec6-957fbb3da6fa",
"id": "d6e87693-41fb-58f5-8e0d-ee9ab46890b5",
"name": "prepare",
"result": [("my_key", " prepared")],
},
@@ -4162,7 +4165,10 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"step": 1,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {"my_key": "value prepared", "market": "DE"},
},
@@ -4172,7 +4178,7 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"timestamp": AnyStr(),
"step": 2,
"payload": {
"id": "122f31bd-0e14-5b8f-91e7-4f241047a3fd",
"id": "b1826010-0028-5aa7-abd2-ed24984614ea",
"name": "tool_two_slow",
"input": {"my_key": "value prepared", "market": "DE"},
"triggers": ["branch:prepare:condition:tool_two_slow"],
@@ -4183,7 +4189,7 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"timestamp": AnyStr(),
"step": 2,
"payload": {
"id": "122f31bd-0e14-5b8f-91e7-4f241047a3fd",
"id": "b1826010-0028-5aa7-abd2-ed24984614ea",
"name": "tool_two_slow",
"result": [("my_key", " slow")],
},
@@ -4194,7 +4200,10 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"step": 2,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {"my_key": "value prepared slow", "market": "DE"},
},
@@ -4204,7 +4213,7 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"timestamp": AnyStr(),
"step": 3,
"payload": {
"id": "48a16051-2c14-5ff5-9cfe-e8c7c32d5c83",
"id": "a22dbd2d-f136-57f0-a86a-bc2c234ffcb1",
"name": "finish",
"input": {"my_key": "value prepared slow", "market": "DE"},
"triggers": ["branch:prepare:condition:then"],
@@ -4215,7 +4224,7 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"timestamp": AnyStr(),
"step": 3,
"payload": {
"id": "48a16051-2c14-5ff5-9cfe-e8c7c32d5c83",
"id": "a22dbd2d-f136-57f0-a86a-bc2c234ffcb1",
"name": "finish",
"result": [("my_key", " finished")],
},
@@ -4226,7 +4235,10 @@ def test_branch_then(snapshot: SnapshotAssertion) -> None:
"step": 3,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {
"my_key": "value prepared slow finished",
+28 -16
View File
@@ -485,7 +485,7 @@ async def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "7a3cc398-2e02-5023-ad7b-e4848d3b67fa",
"id": "9379da35-ae1c-5a7b-8556-7ce22a1f8fde",
"name": "one",
"input": 2,
"triggers": ["input"],
@@ -496,7 +496,7 @@ async def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "34e90af0-f97e-54e0-a159-691da37f175f",
"id": "49ac8f60-4ff2-5cdd-a319-66bbd9837e5a",
"name": "two",
"input": [12],
"triggers": ["inbox"],
@@ -507,7 +507,7 @@ async def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "7a3cc398-2e02-5023-ad7b-e4848d3b67fa",
"id": "9379da35-ae1c-5a7b-8556-7ce22a1f8fde",
"name": "one",
"result": [("inbox", 3)],
},
@@ -517,7 +517,7 @@ async def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 0,
"payload": {
"id": "34e90af0-f97e-54e0-a159-691da37f175f",
"id": "49ac8f60-4ff2-5cdd-a319-66bbd9837e5a",
"name": "two",
"result": [("output", 13)],
},
@@ -533,7 +533,7 @@ async def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "cf7cf374-2a2a-556f-8561-91737af89d2f",
"id": "b97f26c1-a34b-51e0-884e-44a41a3a3b47",
"name": "two",
"input": [3],
"triggers": ["inbox"],
@@ -544,7 +544,7 @@ async def test_invoke_two_processes_in_dict_out(mocker: MockerFixture) -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "cf7cf374-2a2a-556f-8561-91737af89d2f",
"id": "b97f26c1-a34b-51e0-884e-44a41a3a3b47",
"name": "two",
"result": [("output", 4)],
},
@@ -3449,7 +3449,10 @@ async def test_branch_then() -> None:
"step": 0,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {"my_key": "value", "market": "DE"},
},
@@ -3459,7 +3462,7 @@ async def test_branch_then() -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "e7879e70-6335-5867-9ec6-957fbb3da6fa",
"id": "d6e87693-41fb-58f5-8e0d-ee9ab46890b5",
"name": "prepare",
"input": {"my_key": "value", "market": "DE"},
"triggers": ["start:prepare"],
@@ -3470,7 +3473,7 @@ async def test_branch_then() -> None:
"timestamp": AnyStr(),
"step": 1,
"payload": {
"id": "e7879e70-6335-5867-9ec6-957fbb3da6fa",
"id": "d6e87693-41fb-58f5-8e0d-ee9ab46890b5",
"name": "prepare",
"result": [("my_key", " prepared")],
},
@@ -3481,7 +3484,10 @@ async def test_branch_then() -> None:
"step": 1,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {"my_key": "value prepared", "market": "DE"},
},
@@ -3491,7 +3497,7 @@ async def test_branch_then() -> None:
"timestamp": AnyStr(),
"step": 2,
"payload": {
"id": "122f31bd-0e14-5b8f-91e7-4f241047a3fd",
"id": "b1826010-0028-5aa7-abd2-ed24984614ea",
"name": "tool_two_slow",
"input": {"my_key": "value prepared", "market": "DE"},
"triggers": ["branch:prepare:condition:tool_two_slow"],
@@ -3502,7 +3508,7 @@ async def test_branch_then() -> None:
"timestamp": AnyStr(),
"step": 2,
"payload": {
"id": "122f31bd-0e14-5b8f-91e7-4f241047a3fd",
"id": "b1826010-0028-5aa7-abd2-ed24984614ea",
"name": "tool_two_slow",
"result": [("my_key", " slow")],
},
@@ -3513,7 +3519,10 @@ async def test_branch_then() -> None:
"step": 2,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {"my_key": "value prepared slow", "market": "DE"},
},
@@ -3523,7 +3532,7 @@ async def test_branch_then() -> None:
"timestamp": AnyStr(),
"step": 3,
"payload": {
"id": "48a16051-2c14-5ff5-9cfe-e8c7c32d5c83",
"id": "a22dbd2d-f136-57f0-a86a-bc2c234ffcb1",
"name": "finish",
"input": {"my_key": "value prepared slow", "market": "DE"},
"triggers": ["branch:prepare:condition:then"],
@@ -3534,7 +3543,7 @@ async def test_branch_then() -> None:
"timestamp": AnyStr(),
"step": 3,
"payload": {
"id": "48a16051-2c14-5ff5-9cfe-e8c7c32d5c83",
"id": "a22dbd2d-f136-57f0-a86a-bc2c234ffcb1",
"name": "finish",
"result": [("my_key", " finished")],
},
@@ -3545,7 +3554,10 @@ async def test_branch_then() -> None:
"step": 3,
"payload": {
"config": {
"configurable": {"thread_id": "10", "thread_ts": AnyStr()}
"configurable": {
"thread_id": "10",
"thread_ts": AnyStr(),
}
},
"values": {
"my_key": "value prepared slow finished",