Beispiel #1
0
 /**
  * Process message from the grid engine itself. In case the process failed, we keep the work
  * packet around so the developer can reproduce the error.
  *
  * @param w Work packet whose state changed
  */
 @Override
 public void stateChanged(final GridWorkPacket w) {
   if (w == null) {
     return;
   }
   // We report state change just once.
   if (!reported) {
     try {
       if (w.getPassed()) {
         // This is the last response we will send - request is completed.
         // There might have been an error from RMI, check that
         if (allocatorListener.getLastThrowable() == null) {
           sendResponse(
               request, new DaemonProgressMessage(DaemonProgress.RequestCompleted), true);
         } else {
           sendResponse(
               request, new DaemonException(allocatorListener.getLastThrowable()), true);
         }
       } else if (w.getFailed()) {
         // This is the last response we will send - request failed
         if (allocatorListener.getLastThrowable() == null) {
           sendResponse(request, new DaemonException(w.getErrorMessage()), true);
         } else {
           sendResponse(
               request,
               new DaemonException(w.getErrorMessage(), allocatorListener.getLastThrowable()),
               true);
         }
       }
       reported = true;
     } finally {
       if (!w.getFailed()) {
         // Delete workPacket file
         LOGGER.debug("Deleting sge packet file: " + sgePacketFile.getAbsolutePath());
         FileUtilities.quietDelete(sgePacketFile);
       } else {
         LOGGER.warn("Retaining sge packet file: " + sgePacketFile.getAbsolutePath());
       }
     }
   }
 }
Beispiel #2
0
 /** Process failure, return more descriptive exception */
 private DaemonException processFailedJob(
     final GridWorkPacket gridWorkPacket, final File packageFile, final Exception exception) {
   final DaemonException daemonException;
   final File storedFile = failedJobManager.storeFile(packageFile);
   if (storedFile != null) {
     daemonException =
         new DaemonException(
             MessageFormat.format(
                 "Failed passing work packet to grid engine:\n{0}\nUse {1} for the --sge parameter",
                 gridWorkPacket.toString(), storedFile.getAbsolutePath()),
             exception);
   } else {
     daemonException =
         new DaemonException(
             "Failed passing work packet to grid engine:\n" + gridWorkPacket.toString(),
             exception);
   }
   FileUtilities.quietDelete(packageFile);
   LOGGER.error(MprcException.getDetailedMessage(daemonException), daemonException);
   return daemonException;
 }