2424import io .github .jbellis .jvector .example .yaml .MultiConfig ;
2525import io .github .jbellis .jvector .graph .disk .feature .FeatureId ;
2626
27+ import org .slf4j .Logger ;
28+ import org .slf4j .LoggerFactory ;
29+
2730import java .io .File ;
2831import java .io .IOException ;
2932import java .util .ArrayList ;
3841 * for regression testing in the run-bench.yml workflow.
3942 */
4043public class AutoBenchYAML {
44+ private static final Logger logger = LoggerFactory .getLogger (AutoBenchYAML .class );
45+
4146 /**
4247 * Returns a list of all dataset names.
4348 * This replaces the need to load datasets.yml which may not be available in all environments.
@@ -83,11 +88,11 @@ public static void main(String[] args) throws IOException {
8388 }
8489
8590 if (outputPath == null ) {
86- System . err . println ("Error: --output argument is required for AutoBenchYAML" );
91+ logger . error ("Error: --output argument is required for AutoBenchYAML" );
8792 System .exit (1 );
8893 }
8994
90- System . out . println ("Heap space available is " + Runtime .getRuntime ().maxMemory ());
95+ logger . info ("Heap space available is {}" , Runtime .getRuntime ().maxMemory ());
9196
9297 // Filter out --output and its argument from the args
9398 String finalOutputPath = outputPath ;
@@ -102,18 +107,21 @@ public static void main(String[] args) throws IOException {
102107
103108 var datasetNames = getAllDatasetNames ().stream ().filter (dn -> pattern .matcher (dn ).find ()).collect (Collectors .toList ());
104109
105- System . out . println ("Executing the following datasets: " + datasetNames );
110+ logger . info ("Executing the following datasets: {}" , datasetNames );
106111 List <BenchResult > results = new ArrayList <>();
107112
108113 // Process datasets from regex patterns
109114 if (!datasetNames .isEmpty ()) {
110115 for (var datasetName : datasetNames ) {
116+ logger .info ("Loading dataset: {}" , datasetName );
111117 DataSet ds = DataSetLoader .loadDataSet (datasetName );
118+ logger .info ("Dataset loaded: {} with {} vectors" , datasetName , ds .baseVectors .size ());
112119
113120 if (datasetName .endsWith (".hdf5" )) {
114121 datasetName = datasetName .substring (0 , datasetName .length () - ".hdf5" .length ());
115122 }
116123 MultiConfig config = MultiConfig .getDefaultConfig (datasetName );
124+ logger .info ("Using configuration: {}" , config );
117125
118126 results .addAll (Grid .runAllAndCollectResults (ds ,
119127 config .construction .outDegree ,
@@ -132,10 +140,14 @@ public static void main(String[] args) throws IOException {
132140 List <String > configNames = Arrays .stream (filteredArgs ).filter (s -> s .endsWith (".yml" )).collect (Collectors .toList ());
133141 if (!configNames .isEmpty ()) {
134142 for (var configName : configNames ) {
143+ logger .info ("Processing configuration file: {}" , configName );
135144 MultiConfig config = MultiConfig .getConfig (configName );
136145 String datasetName = config .dataset ;
146+ logger .info ("Configuration specifies dataset: {}" , datasetName );
137147
148+ logger .info ("Loading dataset: {}" , datasetName );
138149 DataSet ds = DataSetLoader .loadDataSet (datasetName );
150+ logger .info ("Dataset loaded: {} with {} vectors" , datasetName , ds .baseVectors .size ());
139151
140152 results .addAll (Grid .runAllAndCollectResults (ds ,
141153 config .construction .outDegree ,
@@ -152,11 +164,19 @@ public static void main(String[] args) throws IOException {
152164
153165 // Calculate summary statistics
154166 SummaryStats stats = BenchmarkSummarizer .summarize (results );
155- System . out . println ( stats .toString ());
167+ logger . info ( "Benchmark summary: {}" , stats .toString ());
156168
157169 // Write results to JSON file
158170 ObjectMapper mapper = new ObjectMapper ();
159- mapper .writerWithDefaultPrettyPrinter ().writeValue (new File (outputPath ), results );
160- System .out .println ("Benchmark results written to " + outputPath );
171+ File outputFile = new File (outputPath );
172+ mapper .writerWithDefaultPrettyPrinter ().writeValue (outputFile , results );
173+ logger .info ("Benchmark results written to {} (file exists: {})" , outputPath , outputFile .exists ());
174+
175+ // Double check that the file was created and log its size
176+ if (outputFile .exists ()) {
177+ logger .info ("Output file size: {} bytes" , outputFile .length ());
178+ } else {
179+ logger .error ("Failed to create output file at {}" , outputPath );
180+ }
161181 }
162182}
0 commit comments