This is an automated email from the ASF dual-hosted git repository. SpriCoder pushed a commit to branch fs/inner-view in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit e001982200f241c9018839f1fa086b944d8e304d Author: spricoder <[email protected]> AuthorDate: Sat Nov 21 22:40:06 2026 +0800 [TQTS] bottleneck classifier reads trials/<question>/r<k>/ repeat layout Flat layouts are unchanged: on the nine 2026-11-20 arms summary.md and labelling-sample.tsv are byte-identical to the archived run. --- benchmark/tqtsbench/analyze_bottlenecks.py | 16 ++++++++++++---- benchmark/tqtsbench/test_analyze_bottlenecks.py | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/benchmark/tqtsbench/analyze_bottlenecks.py b/benchmark/tqtsbench/analyze_bottlenecks.py index 0e528aaf572..eb29868e8b6 100644 --- a/benchmark/tqtsbench/analyze_bottlenecks.py +++ b/benchmark/tqtsbench/analyze_bottlenecks.py @@ -161,9 +161,17 @@ def cost(calls): carried_chars=sum(c["chars"] * c["later_messages"] for c in calls)) +def trial_dirs(arm): + """Yield (label, directory) for trials/<question>/ or trials/<question>/r<k>/ layouts.""" + for question in sorted((arm / "trials").iterdir()): + repeats = sorted(r for r in question.glob("r[0-9]*") if r.is_dir()) + for trial in repeats or [question]: + yield (question.name + "/" + trial.name if repeats else question.name), trial + + def main(): p = argparse.ArgumentParser() - p.add_argument("--arm", type=Path, action="append", required=True, help="directory containing trials/<question>/") + p.add_argument("--arm", type=Path, action="append", required=True, help="directory containing trials/<question>/ or trials/<question>/r<k>/") p.add_argument("--output", type=Path, required=True) p.add_argument("--large", type=int, default=8000, help="returned-character threshold for B3/B4") p.add_argument("--sample", type=int, default=50, help="calls in the human-labelling sample") @@ -174,14 +182,14 @@ def main(): for arm in args.arm: name = arm.parent.name + "/" + arm.name if arm.name in {"base", "both", "grid-base", "grid-reduce", "composition", "temporal", "extreme", "grid-only", "reduce-only"} else arm.name trials, all_calls = [], [] - for trial in sorted((arm / "trials").iterdir()): + for label, trial in trial_dirs(arm): if not (trial / "events-summary.jsonl").exists(): continue calls, b5 = analyze_trial(trial, args.large) for c in calls: - c["arm"], c["question_id"] = name, trial.name + c["arm"], c["question_id"] = name, label all_calls += calls - trials.append(dict(question_id=trial.name, total=cost(calls), b5=b5, + trials.append(dict(question_id=label, total=cost(calls), b5=b5, classes={k: cost([c for c in calls if k in c["classes"]]) for k in CLASSES if k != "B5"}, access_shape_union=cost([c for c in calls if set(c["classes"]) & {"B1", "B2", "B3", "B4"}]))) total = cost(all_calls) diff --git a/benchmark/tqtsbench/test_analyze_bottlenecks.py b/benchmark/tqtsbench/test_analyze_bottlenecks.py index ba27c9c51a6..27b267f238a 100644 --- a/benchmark/tqtsbench/test_analyze_bottlenecks.py +++ b/benchmark/tqtsbench/test_analyze_bottlenecks.py @@ -16,9 +16,11 @@ # under the License. import json +from pathlib import Path +import tempfile import unittest -from analyze_bottlenecks import category, outcome, sibling_signature +from analyze_bottlenecks import category, outcome, sibling_signature, trial_dirs class BottleneckRulesTest(unittest.TestCase): @@ -48,6 +50,17 @@ class BottleneckRulesTest(unittest.TestCase): self.assertFalse(err[0]); self.assertIn("Unsupported", err[1]) self.assertTrue(outcome({"content": json.dumps({"stdout": "x", "truncated": True})})[3]) + def test_trial_dirs_accepts_flat_and_repeat_layouts(self): + with tempfile.TemporaryDirectory() as tmp: + arm = Path(tmp) + (arm / "trials" / "q1").mkdir(parents=True) + for r in ("r0", "r1"): + (arm / "trials" / "q2" / r).mkdir(parents=True) + (arm / "trials" / "q2" / "tool-output").mkdir() + labels = [label for label, _ in trial_dirs(arm)] + self.assertEqual(labels, ["q1", "q2/r0", "q2/r1"]) + self.assertEqual(dict(trial_dirs(arm))["q2/r1"], arm / "trials" / "q2" / "r1") + if __name__ == "__main__": unittest.main()
