mirror of
https://github.com/rdk/p2rank.git
synced 2026-06-04 12:44:24 +08:00
improve failed items report for analyze chains command
This commit is contained in:
@@ -23,6 +23,7 @@ import cz.siret.prank.utils.Sutils
|
||||
import cz.siret.prank.utils.Writable
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.util.logging.Slf4j
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils
|
||||
import org.biojava.nbio.structure.Atom
|
||||
import org.biojava.nbio.structure.Group
|
||||
|
||||
@@ -1070,6 +1071,20 @@ class Dataset implements Parametrized, Writable, Failable {
|
||||
Futils.writeFile(csvFile, sb.toString())
|
||||
}
|
||||
|
||||
void writeFullItemErrorsToFile(String txtGzFile) {
|
||||
if (!hasErrors()) {
|
||||
return
|
||||
}
|
||||
|
||||
try (Writer out = Futils.getGzipWriter(txtGzFile)) {
|
||||
for (ItemError ie : errorItems) {
|
||||
out.write("Item: ${ie.item.label}\n")
|
||||
out.write(ErrorUtils.stackTraceToString(ie.exception))
|
||||
out.write("\n\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class ItemError {
|
||||
|
||||
@@ -186,6 +186,7 @@ class AnalyzeRoutine extends Routine {
|
||||
writeFile "$outdir/chains.csv", csv
|
||||
|
||||
res.writeItemErrorsToCsv("$outdir/errors.csv")
|
||||
res.writeFullItemErrorsToFile("$outdir/errors_full.txt.gz")
|
||||
|
||||
write "Processed ${dataset.size} items"
|
||||
write res.errorSummary
|
||||
|
||||
@@ -29,4 +29,8 @@ class ErrorUtils {
|
||||
return ExceptionUtils.getRootCauseMessage(throwable)
|
||||
}
|
||||
|
||||
public static String stackTraceToString(Throwable throwable) {
|
||||
return ExceptionUtils.getStackTrace(throwable)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user