From f03c98d97324d9234c3e32fa89d2bdfe139fd9d5 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 17 May 2010 16:14:48 +0000 Subject: [PATCH] pullJobExecutionStats for JAL-493 --- src/jalview/ws/jws2/MsaWSThread.java | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index c8c49c5..9063b1f 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -493,12 +493,21 @@ class MsaWSThread extends AWS2Thread implements WSClientI { // TODO: investigate if we still need to cast here in J1.6 MsaWSJob j=((MsaWSJob) job); + // this is standard code, but since the interface doesn't comprise of a basic one that implements (getJobStatus, pullExecStatistics) we have to repeat the code for all jw2s services. j.setjobStatus(server.getJobStatus(job.getJobId())); + updateJobProgress(j); + } + protected void updateJobProgress(MsaWSJob j) throws Exception { StringBuffer response = j.jobProgress; - ChunkHolder chunk = server.pullExecStatistics(job.getJobId(), j.getLastChunk()); - response.append(chunk.getChunk()); - j.setLastChunk(chunk.getNextPosition()); - + long lastchunk = j.getLastChunk(); + do { + j.setLastChunk(lastchunk); + ChunkHolder chunk = server.pullExecStatistics(j.getJobId(), lastchunk); + if (chunk!=null) { + response.append(chunk.getChunk()); + lastchunk = chunk.getNextPosition(); + }; + } while (lastchunk>=0 && j.getLastChunk()!=lastchunk); } public void StartJob(AWsJob job) @@ -582,6 +591,20 @@ class MsaWSThread extends AWS2Thread implements WSClientI if (jobs[j].isFinished() && msjob.alignment==null) { try { + updateJobProgress(msjob); + } catch (Exception e) + { + Cache.log.warn("Exception when retrieving remaining Job progress data for job "+msjob.getJobId()+" on server "+WsUrl); + e.printStackTrace(); + } + if (Cache.log.isDebugEnabled()) + { + System.out.println("Job Execution file for job: "+msjob.getJobId()+" on server "+WsUrl); + System.out.println(msjob.getStatus()); + System.out.println("*** End of status"); + + } + try { msjob.alignment = server.getResult(msjob.getJobId()); } catch (Exception e) -- 1.7.10.2