JAL-3878 Add job log messages reporting.
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Thu, 30 Sep 2021 15:08:32 +0000 (17:08 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Thu, 30 Sep 2021 15:08:32 +0000 (17:08 +0200)
src/jalview/ws2/slivka/SlivkaWebService.java

index 3f0f5b0..bd4cb61 100644 (file)
@@ -1,6 +1,7 @@
 package jalview.ws2.slivka;
 
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -189,6 +190,22 @@ public class SlivkaWebService implements WebServiceI
   {
     var slivkaJob = client.getJob(job.getJobId());
     job.setStatus(statusMap.get(slivkaJob.getStatus()));
+    Collection<RemoteFile> files = slivkaJob.getResults();
+    for (RemoteFile f : files)
+    {
+      if (f.getLabel().equals("log"))
+      {
+        ByteArrayOutputStream stream = new ByteArrayOutputStream();
+        f.writeTo(stream);
+        job.setLog(stream.toString("UTF-8"));
+      }
+      else if (f.getLabel().equals("error-log"))
+      {
+        ByteArrayOutputStream stream = new ByteArrayOutputStream();
+        f.writeTo(stream);
+        job.setErrorLog(stream.toString("UTF-8"));
+      }
+    }
   }
 
   @Override