Bug fixes to allow us to generate GATKRunReports for very early errors that leave the engine in a corrupt state. Vastly better error handling of common command line problems. Analysis output now notes whether an exception is a a UserException or a StingException
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4278 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
2be5e862f1
commit
74d4f124b1
|
|
@ -338,8 +338,8 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
// if their argument has no value (null), and there's a default, return that default for the enum value
|
// if their argument has no value (null), and there's a default, return that default for the enum value
|
||||||
if (defaultEnumeration != null && value == null)
|
if (defaultEnumeration != null && value == null)
|
||||||
result = defaultEnumeration;
|
result = defaultEnumeration;
|
||||||
// if their argument has no value and there's no default, throw a missing argument value exception.
|
// if their argument has no value and there's no default, throw a missing argument value exception.
|
||||||
// TODO: Clean this up so that null values never make it to this point. To fix this, we'll have to clean up the implementation of -U.
|
// TODO: Clean this up so that null values never make it to this point. To fix this, we'll have to clean up the implementation of -U.
|
||||||
else if (value == null)
|
else if (value == null)
|
||||||
throw new MissingArgumentValueException(Collections.singleton(createDefaultArgumentDefinition(source)));
|
throw new MissingArgumentValueException(Collections.singleton(createDefaultArgumentDefinition(source)));
|
||||||
else
|
else
|
||||||
|
|
@ -348,12 +348,16 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
Constructor ctor = type.getConstructor(String.class);
|
Constructor ctor = type.getConstructor(String.class);
|
||||||
result = ctor.newInstance(value);
|
result = ctor.newInstance(value);
|
||||||
}
|
}
|
||||||
|
} catch (UserException e) {
|
||||||
|
throw e;
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
throw new ReviewedStingException("constructFromString:InvocationTargetException: Failed conversion - this is most likely caused by using an incorrect data type (e.g. a double when an int is required)");
|
throw new UserException.CommandLineException(String.format("Failed to parse value %s for argument %s. This is most commonly caused by providing an incorrect data type (e.g. a double when an int is required)",
|
||||||
|
value, source.field.getName()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new DynamicClassResolutionException(String.class, e);
|
throw new DynamicClassResolutionException(String.class, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO FIXME!
|
||||||
|
|
||||||
// WARNING: Side effect!
|
// WARNING: Side effect!
|
||||||
parsingEngine.addTags(result,tags);
|
parsingEngine.addTags(result,tags);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
import org.simpleframework.xml.ElementList;
|
import org.simpleframework.xml.ElementList;
|
||||||
import org.simpleframework.xml.Serializer;
|
import org.simpleframework.xml.Serializer;
|
||||||
|
|
@ -93,23 +94,23 @@ public class GATKRunReport {
|
||||||
@Element(required = false, name = "exception")
|
@Element(required = false, name = "exception")
|
||||||
private final ExceptionToXML mException;
|
private final ExceptionToXML mException;
|
||||||
|
|
||||||
@Element(required = true, name = "argument_collection")
|
@Element(required = false, name = "argument_collection")
|
||||||
private final GATKArgumentCollection mCollection;
|
private final GATKArgumentCollection mCollection;
|
||||||
|
|
||||||
@Element(required = true, name = "working_directory")
|
@Element(required = true, name = "working_directory")
|
||||||
private String currentPath;
|
private String currentPath;
|
||||||
|
|
||||||
@Element(required = true, name = "start_time")
|
@Element(required = true, name = "start_time")
|
||||||
private String startTime;
|
private String startTime = "ND";
|
||||||
|
|
||||||
@Element(required = true, name = "end_time")
|
@Element(required = true, name = "end_time")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
@Element(required = true, name = "run_time")
|
@Element(required = true, name = "run_time")
|
||||||
private long runTime;
|
private long runTime = 0;
|
||||||
|
|
||||||
@Element(required = true, name = "command_line")
|
@Element(required = true, name = "command_line")
|
||||||
private String cmdLine;
|
private String cmdLine = "COULD NOT BE DETERMINED";
|
||||||
|
|
||||||
@Element(required = true, name = "walker_name")
|
@Element(required = true, name = "walker_name")
|
||||||
private String walkerName;
|
private String walkerName;
|
||||||
|
|
@ -176,16 +177,21 @@ public class GATKRunReport {
|
||||||
|
|
||||||
// what did we run?
|
// what did we run?
|
||||||
id = org.apache.commons.lang.RandomStringUtils.randomAlphanumeric(32);
|
id = org.apache.commons.lang.RandomStringUtils.randomAlphanumeric(32);
|
||||||
cmdLine = CommandLineUtils.createApproximateCommandLineArgumentString(engine, walker);
|
try {
|
||||||
|
cmdLine = CommandLineUtils.createApproximateCommandLineArgumentString(engine, walker);
|
||||||
|
} catch (Exception ignore) { }
|
||||||
|
|
||||||
this.mCollection = engine.getArguments();
|
this.mCollection = engine.getArguments();
|
||||||
walkerName = engine.getWalkerName(walker.getClass());
|
walkerName = engine.getWalkerName(walker.getClass());
|
||||||
svnVersion = CommandLineGATK.getVersionNumber();
|
svnVersion = CommandLineGATK.getVersionNumber();
|
||||||
|
|
||||||
// runtime performance metrics
|
// runtime performance metrics
|
||||||
startTime = dateFormat.format(engine.getStartTime());
|
|
||||||
Date end = new java.util.Date();
|
Date end = new java.util.Date();
|
||||||
endTime = dateFormat.format(end);
|
endTime = dateFormat.format(end);
|
||||||
runTime = (end.getTime() - engine.getStartTime().getTime()) / 1000L; // difference in seconds
|
if ( engine.getStartTime() != null ) { // made it this far during initialization
|
||||||
|
startTime = dateFormat.format(engine.getStartTime());
|
||||||
|
runTime = (end.getTime() - engine.getStartTime().getTime()) / 1000L; // difference in seconds
|
||||||
|
}
|
||||||
tmpDir = System.getProperty("java.io.tmpdir");
|
tmpDir = System.getProperty("java.io.tmpdir");
|
||||||
|
|
||||||
// deal with memory usage
|
// deal with memory usage
|
||||||
|
|
@ -310,8 +316,12 @@ public class GATKRunReport {
|
||||||
@Element(required = false, name = "cause")
|
@Element(required = false, name = "cause")
|
||||||
ExceptionToXML cause = null;
|
ExceptionToXML cause = null;
|
||||||
|
|
||||||
|
@Element(required = false, name = "is-user-exception")
|
||||||
|
Boolean isUserException;
|
||||||
|
|
||||||
public ExceptionToXML(Throwable e) {
|
public ExceptionToXML(Throwable e) {
|
||||||
message = e.getMessage();
|
message = e.getMessage();
|
||||||
|
isUserException = e instanceof UserException;
|
||||||
for (StackTraceElement element : e.getStackTrace()) {
|
for (StackTraceElement element : e.getStackTrace()) {
|
||||||
stackTrace.add(element.toString());
|
stackTrace.add(element.toString());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue