def get_VAMPS_submission_status_row(self, sess_obj):
        vamps_session = None
        session_to_use = None
        mobedac_logger.debug("vamps_status_record_id " + str(self.vamps_status_record_id))

        try:
            if False:  # environment == 'test':
                session_to_use = sess_obj
            else:
                session_to_use = vampsSession()
            result_row = session_to_use.execute(
                "SELECT status, status_message FROM vamps_upload_status where id=:id",
                {"id": self.vamps_status_record_id},
            ).first()
            mobedac_logger.debug(
                "SELECT status, status_message FROM vamps_upload_status where id=:id"
                + self.vamps_status_record_id
                + " and result: "
                + str(result_row)
            )
            return result_row
        except:
            mobedac_logger.exception(
                "submissionORM error retrieving vamps_upload_status with id: " + self.vamps_status_record_id
            )
            raise
        finally:
            # if using the vamps db session then close it...the other one will be closed by the request processing thread or whoever
            if environment == "test":
                session_to_use.close()
    def get_VAMPS_submission_status_row(self, sess_obj):
        vamps_session = None
        session_to_use = None
        mobedac_logger.debug("vamps_status_record_id " +
                             str(self.vamps_status_record_id))

        try:
            if False:  #environment == 'test':
                session_to_use = sess_obj
            else:
                session_to_use = vampsSession()
            result_row = session_to_use.execute(
                "SELECT status, status_message FROM vamps_upload_status where id=:id",
                {
                    'id': self.vamps_status_record_id
                }).first()
            mobedac_logger.debug(
                "SELECT status, status_message FROM vamps_upload_status where id=:id"
                + self.vamps_status_record_id + " and result: " +
                str(result_row))
            return result_row
        except:
            mobedac_logger.exception(
                "submissionORM error retrieving vamps_upload_status with id: "
                + self.vamps_status_record_id)
            raise
        finally:
            # if using the vamps db session then close it...the other one will be closed by the request processing thread or whoever
            if environment == 'test':
                session_to_use.close()
 def stop_the_server(self):
     try:
         mobedac_logger.debug("Telling submission processing thread to shutdown...")
         self.submission_processor_thread.stop_processing()
         # wait here for the processor to stop
         self.submission_processor_thread.join(20.0)
         # did it stop? do we need to to whack it?
         if self.submission_processor_thread.is_alive():
             self.submission_processor_thread.stop_processing()
     except:
         mobedac_logger.exception("Got error trying to stop submission processor thread")
     cherrypy.engine.exit()
Пример #4
0
 def __init__(self, value):
     super(ObjectRetrievalException, self).__init__(value)
     self.value = value
     mobedac_logger.exception(value)
Пример #5
0
 def log_exception(self, msg):
     mobedac_logger.exception(msg)
 def get_current_status(self):
     status = {}
     try:
         # this is more complicated since there is no message on our side so at this point
         # this web service does not think there is an error...but perhaps VAMPS has run
         # into an error?
         if self.next_action == self.ACTION_DOWNLOAD:
             # we are telling them that VAMPS is doing the retrieval but it is really
             # this web service that grabs the data and then passes it off to VAMPS
             msg = "The VAMPS system is still retrieving the data from MoBEDAC."
             code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_VAMPS_UPLOAD:
             msg = "The data has been retrieved from MoBEDAC and will soon be uploaded to the VAMPS processor."
             code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_GAST:
             # so at this point this WS successfully passed the data off to VAMPS who
             # is doing the trimming...we need to check with VAMPS
             vamps_status_row = self.get_VAMPS_submission_status_row(None)
             # need to get the status value
             status = vamps_status_row[0]
             if status == 'TRIM_ERROR':
                 # for now
                 msg = "There was an error during VAMPS upload processing"
                 code = self.ERROR_STATUS
             elif status == 'TRIM_PROCESSING':
                 # for now
                 msg = "The data is being uploaded and quality checked by the VAMPS system."
                 code = self.PROCESSING_STATUS
             else:
                 # for now
                 msg = "The data was successfully uploaded and quality checked by VAMPS and is awaiting GAST processing"
                 code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_POST_RESULTS_TO_MOBEDAC:
             # at this point the WS started up the GAST on VAMPS and so we need to check
             # with VAMPS to check the VAMPS Gasting status
             vamps_status_row = self.get_VAMPS_submission_status_row(None)
             status = vamps_status_row[0]
             if status == 'GAST_PROCESSING':
                 msg = "The VAMPS system is performing GAST processing."
                 code = self.PROCESSING_STATUS
             elif status == 'GAST_SUCCESS':
                 msg = "The VAMPS system has successfully completed the GAST processing. And needs to be returned to MoBEDAC"
                 code = self.PROCESSING_STATUS
             elif status == 'GAST_ERROR':
                 msg = "There was an error during GAST processing"
                 code = self.ERROR_STATUS
             else:
                 msg = "The VAMPS system is performing GAST processing."
                 code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_PROCESSING_COMPLETE:
             msg = "Processing is complete and data has been returned to MoBEDAC."
             code = self.COMPLETE_SUCCESS_STATUS
         else:
             # this is kind of an error state?
             msg = "The submission is in state: " + self.next_action
             code = 4
     except:
         mobedac_logger.exception(
             "submissionORM error generating submission status message")
         msg = "There was an error retrieving the status of this submission"
         code = self.ERROR_STATUS
     mobedac_logger.debug("status_code " + str(code) + " current_status " +
                          str(msg))
     return {"status_code": code, "current_status": msg}
 def get_current_status(self):
     status = {}
     try:
         # this is more complicated since there is no message on our side so at this point
         # this web service does not think there is an error...but perhaps VAMPS has run
         # into an error?
         if self.next_action == self.ACTION_DOWNLOAD:
             # we are telling them that VAMPS is doing the retrieval but it is really
             # this web service that grabs the data and then passes it off to VAMPS
             msg = "The VAMPS system is still retrieving the data from MoBEDAC."
             code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_VAMPS_UPLOAD:
             msg = "The data has been retrieved from MoBEDAC and will soon be uploaded to the VAMPS processor."
             code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_GAST:
             # so at this point this WS successfully passed the data off to VAMPS who
             # is doing the trimming...we need to check with VAMPS 
             vamps_status_row = self.get_VAMPS_submission_status_row(None)     
             # need to get the status value
             status = vamps_status_row[0]
             if status == 'TRIM_ERROR':
                 # for now
                 msg = "There was an error during VAMPS upload processing"
                 code = self.ERROR_STATUS
             elif status == 'TRIM_PROCESSING':
                 # for now
                 msg = "The data is being uploaded and quality checked by the VAMPS system."
                 code = self.PROCESSING_STATUS
             else:
                 # for now
                 msg = "The data was successfully uploaded and quality checked by VAMPS and is awaiting GAST processing"
                 code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_POST_RESULTS_TO_MOBEDAC:
             # at this point the WS started up the GAST on VAMPS and so we need to check
             # with VAMPS to check the VAMPS Gasting status
             vamps_status_row = self.get_VAMPS_submission_status_row(None)  
             status = vamps_status_row[0]
             if status == 'GAST_PROCESSING':
                 msg = "The VAMPS system is performing GAST processing."   
                 code = self.PROCESSING_STATUS
             elif status == 'GAST_SUCCESS':
                 msg = "The VAMPS system has successfully completed the GAST processing. And needs to be returned to MoBEDAC"   
                 code = self.PROCESSING_STATUS
             elif status == 'GAST_ERROR':
                 msg = "There was an error during GAST processing"
                 code = self.ERROR_STATUS
             else:
                 msg = "The VAMPS system is performing GAST processing."   
                 code = self.PROCESSING_STATUS
         elif self.next_action == self.ACTION_PROCESSING_COMPLETE:
             msg = "Processing is complete and data has been returned to MoBEDAC."
             code = self.COMPLETE_SUCCESS_STATUS
         else:
             # this is kind of an error state?
             msg = "The submission is in state: " + self.next_action
             code = 4
     except:
         mobedac_logger.exception("submissionORM error generating submission status message")
         msg = "There was an error retrieving the status of this submission"
         code = self.ERROR_STATUS
     return {"status_code" : code, "current_status" : msg}
 def __init__(self, value):
     super(ObjectRetrievalException, self).__init__(value)
     self.value = value
     mobedac_logger.exception(value)
 def __init__(self, value):
     super(SubmissionException, self).__init__(value)
     self.value = value
     mobedac_logger.info(value)
     mobedac_logger.exception(value)