t8y2/dbx · error · FileNotFoundError

FileNotFoundError(path)

Error message

FileNotFoundError(path)

What it means

ensure_artifacts in the IoTDB benchmark script verifies that the required JDBC driver JAR and the Go benchmark binary exist on disk before benchmarking. If either path is missing it raises FileNotFoundError with the offending path. This fails fast so the benchmark doesn't crash later with a confusing subprocess error.

Source

Thrown at agents/drivers/iotdb/bench/run.py:221

                "round_mean_ms": summarize([value["mean_ms"] for value in values]),
                "round_p50_ms": summarize([value["p50_ms"] for value in values]),
                "round_p95_ms": summarize([value["p95_ms"] for value in values]),
            }
            for name, values in workloads.items()
        },
        "rounds": rounds,
    }


def percentile(values: list[float], fraction: float) -> float:
    index = max(0, min(len(values) - 1, int(len(values) * fraction + 0.999999) - 1))
    return values[index]


def ensure_artifacts() -> None:
    for path in (JDBC_JAR, GO_BINARY):
        if not path.is_file():
            raise FileNotFoundError(path)


def benchmark_order(commands: dict[str, list[str]]) -> list[str]:
    names = [name.strip() for name in os.getenv("BENCH_ORDER", "jdbc,go").split(",") if name.strip()]
    if len(names) != len(commands) or set(names) != set(commands):
        raise ValueError(f"BENCH_ORDER must contain exactly: {','.join(commands)}")
    return names


def env_int(name: str, fallback: int) -> int:
    value = int(os.getenv(name, str(fallback)))
    if value <= 0:
        raise ValueError(f"{name} must be positive")
    return value


def env_float(name: str, fallback: float) -> float:
    value = float(os.getenv(name, str(fallback)))

View on GitHub (pinned to c0390bff16)

Solutions

  1. Build/download the missing artifacts before running the script (e.g. run the go build step for GO_BINARY and fetch JDBC_JAR).
  2. Verify the expected paths exist: ls the locations referenced by JDBC_JAR and GO_BINARY in run.py.
  3. Run the script from the intended working directory so relative artifact paths resolve correctly.
  4. Add a pre-flight step to CI that runs ensure_artifacts (or the equivalent checks) after building.

Example fix

# before
python agents/drivers/iotdb/bench/run.py
# after
go build -o agents/drivers/iotdb/bench/bench-go ./bench-go && python agents/drivers/iotdb/bench/run.py
Defensive patterns

Strategy: validation

Validate before calling

from agents.drivers.iotdb.bench.run import JDBC_JAR, GO_BINARY
missing = [p for p in (JDBC_JAR, GO_BINARY) if not p.is_file()]
if missing:
    raise SystemExit(f"missing artifacts: {missing}")

Try / catch

try:
    main()
except FileNotFoundError as e:
    print(f"artifact missing: {e}; run the build step first")

Prevention

When it happens

Trigger: Running main() when JDBC_JAR or GO_BINARY (predefined pathlib.Path constants) does not point to an existing regular file — the JAR was never downloaded, the Go binary was never built, or the script is run from a different working directory/environment than the one where artifacts were produced.

Common situations: Fresh clone where `go build` was skipped; CI cache evicted the JAR; artifacts placed at a different path after a refactor of the constants; running the bench script before the build step of a pipeline.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/44b648be1b3e4929. Report an issue: GitHub.