Index: trunk/ippToPsps/jython/batch.py
===================================================================
--- trunk/ippToPsps/jython/batch.py	(revision 33671)
+++ trunk/ippToPsps/jython/batch.py	(revision 33672)
@@ -10,4 +10,7 @@
 import logging
 from subprocess import call, PIPE, Popen
+from java.lang import *
+from java.sql import *
+from xml.etree.ElementTree import ElementTree, Element, tostring
 
 from scratchdb import ScratchDb
@@ -15,8 +18,4 @@
 from ipptopspsdb import IppToPspsDb
 from fits import Fits
-
-from java.lang import *
-from java.sql import *
-from xml.etree.ElementTree import ElementTree, Element, tostring
 
 '''
@@ -69,10 +68,4 @@
                 return
 
-        # if no fits file, and this is not an IN batch, then get out of here
-        else:
-           if batchType != "IN": 
-               logger.errorPair("Could not read FITS for id", "%d" % id)
-               return
-
         self.scratchDb.setUseFullTables(self.useFullTables)
 
@@ -306,7 +299,4 @@
             return False
 
-        # only now can we report that the batch has successfully processed
-        self.ippToPspsDb.updateProcessed(self.batchID, 1)
-
         # delete tar file and original directory
         os.remove(tarPath)
@@ -420,4 +410,6 @@
       self.logger.infoPair("Done. Imported", "%d tables" % count)
       self.indexIppTables()
+
+      return True
 
     '''
@@ -519,33 +511,45 @@
 
         if not self.everythingOK:
-            self.logger.error("Aborting this batch due to (hopefully) previously reported errors")
+            self.logger.errorPair("Aborting this batch", "could not initialize")
             self.ippToPspsDb.updateProcessed(self.batchID, -1)
             return
 
         if not self.createEmptyPspsTables():
-            self.logger.error("Aborting this batch due to (hopefully) previously reported errors")
+            self.logger.errorPair("Aborting this batch", "could not create empty PSPS tables")
             self.ippToPspsDb.updateProcessed(self.batchID, -1)
             return
 
-        self.importIppTables()
+        if not self.importIppTables():
+            self.logger.errorPair("Aborting this batch", "could not import IPP tables")
+            self.ippToPspsDb.updateProcessed(self.batchID, -1)
+            return
+
         if not self.populatePspsTables():
             self.logger.errorPair("Aborting this batch", "unable to populate PSPS tables")
             self.ippToPspsDb.updateProcessed(self.batchID, -1)
-        else:
-            if not self.exportPspsTablesToFits():
-                self.logger.errorPair("Aborting this batch", "unable to export tables to FITS file")
-            else:
-                if self.writeBatchManifest():
-                    if self.config.datastorePublishing: 
-                        # tar and zip ready for publication to datastore
-                        if self.tarAndZip():
-                            # now publish to the datastore
-                            tarballFile = Batch.getTarballFile(self.batchID)
-                            Batch.publishToDatastore(
-                                    self.datastore, 
-                                    self.batchID, 
-                                    self.batchName, 
-                                    self.subDir, 
-                                    tarballFile)
+            return 
+
+        if not self.exportPspsTablesToFits():
+            self.logger.errorPair("Aborting this batch", "unable to export tables to FITS file")
+            self.ippToPspsDb.updateProcessed(self.batchID, -1)
+            return 
+   
+        if self.writeBatchManifest():
+            if self.config.datastorePublishing: 
+
+                # tar and zip ready for publication to datastore
+                if self.tarAndZip():
+
+                    # only now can we report that the batch has successfully processed
+                    self.ippToPspsDb.updateProcessed(self.batchID, 1)
+                    
+                    # now publish to the datastore
+                    tarballFile = Batch.getTarballFile(self.batchID)
+                    Batch.publishToDatastore(
+                            self.datastore, 
+                            self.batchID, 
+                            self.batchName, 
+                            self.subDir, 
+                            tarballFile)
 
 from datastore import Datastore
