- @Override
- public void run()
- {
- if (aaservice == null)
- {
- return;
- }
-
- try
- {
- if (checkDone())
- {
- return;
- }
- List<compbio.data.sequence.FastaSequence> seqs = getInputSequences(alignViewport
- .getAlignment());
-
- if (seqs == null)
- {
- calcMan.workerComplete(this);
- return;
- }
-
- AlignmentAnnotation[] aa = alignViewport.getAlignment()
- .getAlignmentAnnotation();
-
- String rslt;
- if (preset == null)
- {
- rslt = aaservice.analize(seqs);
- }
- else
- {
- try
- {
- rslt = aaservice.customAnalize(seqs, getJabaArguments());
- } catch (WrongParameterException x)
- {
- throw new JobSubmissionException(
- "Invalid paremeter set. Check Jalview implementation.", x);
-
- }
- }
- boolean finished = false;
- long rpos = 0;
- do
- {
- JobStatus status = aaservice.getJobStatus(rslt);
- if (status.equals(JobStatus.FINISHED))
- {
- finished = true;
- }
- long cpos;
- ChunkHolder stats;
- do
- {
- cpos = rpos;
- try
- {
- stats = aaservice.pullExecStatistics(rslt, rpos);
- } catch (Exception x)
- {
-
- if (x.getMessage().contains(
- "Position in a file could not be negative!"))
- {
- // squash index out of bounds exception- seems to happen for
- // disorder predictors which don't (apparently) produce any
- // progress information and JABA server throws an exception
- // because progress length is -1.
- stats = null;
- }
- else
- {
- throw x;
- }
- }
- if (stats != null)
- {
- System.out.print(stats.getChunk());
- rpos = stats.getNextPosition();
- }
- } while (stats != null && rpos > cpos);
-
- if (!finished && status.equals(JobStatus.FAILED))
- {
- try
- {
- Thread.sleep(200);
- } catch (InterruptedException x)
- {
- }
- ;
- }
-
- } while (!finished);
- try
- {
- Thread.sleep(200);
- } catch (InterruptedException x)
- {
- }
- ;
- scoremanager = aaservice.getAnnotation(rslt);
- if (scoremanager != null)
- {
- updateResultAnnotation(true);
- }
- } catch (JobSubmissionException x)
- {
-
- System.err.println("submission error:");
- x.printStackTrace();
- calcMan.workerCannotRun(this);
- } catch (ResultNotAvailableException x)
- {
- System.err.println("collection error:");
- x.printStackTrace();
- calcMan.workerCannotRun(this);
-
- } catch (OutOfMemoryError error)
- {
- calcMan.workerCannotRun(this);
-
- // consensus = null;
- // hconsensus = null;
- ap.raiseOOMWarning(getServiceActionText(), error);
- } catch (Exception x)
- {
- calcMan.workerCannotRun(this);
-
- // consensus = null;
- // hconsensus = null;
- System.err
- .println("Blacklisting worker due to unexpected exception:");
- x.printStackTrace();
- } finally
- {
-
- calcMan.workerComplete(this);
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
- }
-
- }
-
- public void updateAnnotation()
- {
- updateResultAnnotation(false);
- }
-
- public abstract void updateResultAnnotation(boolean immediate);
-
- public abstract String getServiceActionText();
-
- boolean submitGaps = true;
-
- boolean alignedSeqs = true;
-
- boolean nucleotidesAllowed = false;
-
- boolean proteinAllowed = false;
-