From: jprocter Date: Fri, 21 Sep 2012 16:25:24 +0000 (+0100) Subject: JAL-849 try harder and wait for longer for JABAWS to send back job output. X-Git-Tag: Jalview_2_9~307^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a883b8a87fe965a1d04f67b6f82c985b0b2c8605;p=jalview.git JAL-849 try harder and wait for longer for JABAWS to send back job output. --- diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index 86f5fbc..6ef07c6 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -516,7 +516,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI try { boolean cancelledJob = server.cancelJob(jobs[job].getJobId()); - if (cancelledJob || true) + if (true) // cancelledJob || true) { // CANCELLED_JOB // if the Jaba server indicates the job can't be cancelled, its @@ -594,9 +594,12 @@ class MsaWSThread extends AWS2Thread implements WSClientI .pullExecStatistics(j.getJobId(), lastchunk); if (chunk != null) { - changed=chunk.getChunk().length()>0; + changed|=chunk.getChunk().length()>0; response.append(chunk.getChunk()); lastchunk = chunk.getNextPosition(); + try { + Thread.sleep(50); + } catch (InterruptedException x){}; } ; } while (lastchunk >= 0 && j.getLastChunk() != lastchunk); @@ -737,12 +740,16 @@ class MsaWSThread extends AWS2Thread implements WSClientI MsaWSJob msjob = ((MsaWSJob) jobs[j]); if (jobs[j].isFinished() && msjob.alignment == null) { + int nunchanged=3,nexcept=3; boolean jpchanged=false,jpex=false; do { try { jpchanged = updateJobProgress(msjob); jpex=false; + if (jpchanged) { + nexcept=3; + } } catch (Exception e) { @@ -750,26 +757,24 @@ class MsaWSThread extends AWS2Thread implements WSClientI .warn("Exception when retrieving remaining Job progress data for job " + msjob.getJobId() + " on server " + WsUrl); e.printStackTrace(); - if (jpex) { - // give up polling after two consecutive exceptions - jpchanged=false; - } else { - jpchanged=true; - } + nexcept--; + nunchanged=3; // set flag remember that we've had an exception. jpex=true; + jpchanged=false; } - if (jpchanged) + if (!jpchanged) { try { - Thread.sleep(jpex ? 400 : 200); // wait a bit longer if we experienced an exception. + Thread.sleep(jpex ? 2400 : 1200); // wait a bit longer if we experienced an exception. } catch (Exception ex) { } ; - } - } while (jpchanged); + nunchanged--; + } + } while (nunchanged>0 && nexcept>0); if (Cache.log.isDebugEnabled()) { @@ -789,6 +794,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI Cache.log .debug("Results not available for finished job - marking as broken job.", e); + msjob.jobProgress + .append("\nResult not available. Probably due to invalid input or parameter settings. Server error message below:\n\n" + + e.getLocalizedMessage()); msjob.setjobStatus(JobStatus.FAILED); } catch (Exception e) {