Пример #1
0
 def process_additional_data(self):
     """Start of Processing process_additional_data"""
     # Gets all record for minimum sync_id sorted by _id and created_time
     pending_sync_list = self.syncDb.get_pending_sync_to_process()
     if pending_sync_list and pending_sync_list.count() > 0:
         for record in pending_sync_list:
             print " process: Processing _id :" + str(record["_id"])
             try:
                 if not self.syncDb.get_sync_by_id(str(record["_id"])).get(
                         "processed_additional_data", False):
                     directory_to_import_from = SyncHelperService.get_source_dir(
                         record)
                     if directory_to_import_from:
                         SyncHelperService.handle_additional_data_while_processing_sync(
                             directory_to_import_from, plugin_full_path)
                         self.syncDb.update_add_processed_by_sync_id(
                             record["sync_id"])
             except Exception as e_value:  # catch *all* exceptions
                 traceback.print_exc()
                 self.syncDb.update_sync_status(
                     str(record["_id"]), "failed",
                     "Processing additional data failed with error" +
                     str(e_value))
Пример #2
0
 def process_sync(self):
     """Start of Processing"""
     sync_id = sync_type = directory_to_import_from = None
     # Gets all record for minimum sync_id sorted by _id and created_time
     pending_sync_list = self.syncDb.get_pending_sync_to_process()
     if pending_sync_list:
         print 'No of Pending Sync List to process:' + str(
             pending_sync_list.count())
     else:
         print 'process:No of Pending Sync List to process:' + str(
             0) + ". Existing.."
         return
     for record in pending_sync_list:
         print " process: Processing _id :" + str(record["_id"])
         try:
             sync_id, sync_type = SyncHelperService.get_sync_id_and_type(
                 record)
             directory_to_import_from = SyncHelperService.get_source_dir(
                 record)
             distribution_list = None
             self.handle_extra_validations(record)
             print 'Process: Working on sync_id :' + sync_id + " _id :" + str(
                 record["_id"])
             full_sync_flag, distribution_list = SyncHelperService.get_distribution_list_and_status(
                 self.result
             )  # Distribution_list can be empty # full_sync_flag is mandatory
             self.handle_operation(record, full_sync_flag,
                                   directory_to_import_from)
             print 'Process: Done on sync_id :' + sync_id + " _id :" + str(
                 record["_id"])
         except Exception as e_value:  # catch *all* exceptions
             traceback.print_exc()
             self.syncDb.update_sync_status(str(record["_id"]), "failed",
                                            str(e_value))
     # Notify Users
     SyncHelperService.notify(sync_id, distribution_list, self.mailer)