Skip to content

Commit

Permalink
Try to throw an exception with the end of the log file if the coref b…
Browse files Browse the repository at this point in the history
…enchmark test doesn't work as expected
  • Loading branch information
AngledLuffa committed Jun 26, 2024
1 parent 243a8df commit 6e554c7
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -130,6 +131,14 @@ public static Counter<String> getCorefResults(String resultsString) throws IOExc
}
}

if (results.keySet().isEmpty()) {
List<String> lines = StringUtils.split(resultsString, "\\R");
int start = Math.max(0, lines.size() - 20);
lines = lines.subList(start, lines.size() - start);
String tail = StringUtils.join(lines, "\n");
throw new RuntimeException("Coref output did not have any results in it! The end of the log is as follows:\n" + tail);
}

return results;
}

Expand Down

0 comments on commit 6e554c7

Please sign in to comment.