* doesn't actually run the job. This is a lightweight way to validate that
* the given parameters are correct for a specified tool.
*/
- public void validateJobParams(String toolName)
+ public CiJob validateJobParams(String toolName)
{
+ CiJob validateJob = null;
try
{
- CiJob validateJob = cipresClient
+ validateJob = cipresClient
.validateJob(toolName, vParams, inputParams, metadata);
validateJob.show(true); // currently outputs just to console, should be
// graphical
paramsValidated = true;
+
} catch (CiCipresException ce)
{
- paramsValidated = false; // parameters gave an error.
ErrorData ed = ce.getErrorData();
System.out.println(
"Cipres error while trying to validate parameters, code="
}
}
}
-
+ return validateJob;
}
- public void submitJob(String toolName)
+ /**
+ * Sends the job to CIPRES. If the job hasn't been validated beforehand this
+ * method will do so before submitting.
+ *
+ * @param toolName
+ */
+ public CiJob submitJob(String toolName)
{
+ CiJob submittedJob = null;
if (!paramsValidated)
{
- validateJobParams(toolName); // validate before running some expensive job
- // first
+ // validate before running some expensive job first.
+ CiJob validateJob = validateJobParams(toolName);
+
+ // should be redundant but extra check here anyway.
+ if (!validateJob.isError())
+ {
+ submittedJob = submitJob(toolName);
+ }
}
+ else
+ {
+ try
+ {
+ submittedJob = cipresClient
+ .submitJob(toolName, vParams, inputParams, metadata);
+ } catch (CiCipresException ce)
+ {
+ ErrorData ed = ce.getErrorData();
+ System.out.println(
+ "Cipres error in submitted job, code="
+ + ed.code + ", message=" + ed.displayMessage);
+ if (ed.code == ErrorData.FORM_VALIDATION)
+ {
+ for (ParamError pe : ed.paramError)
+ // invalid parameters shouldn't be possible here but just in case.
+ {
+ System.out.println(pe.param + ": " + pe.error);
+ }
+ }
+ }
+ }
+ return submittedJob;
}