def _update_task_tracker( self, message ): """ Updates redis 'bell:tracker' accession number entry. """ try: from tasks import task_manager task_manager.update_tracker( key=self.accession_number, message=message ) except Exception as e: print '- in fedora_metadata_updater_and image_builder.Task._update_task_tracker(); exception: %s' % unicode(repr(e)) pass return
def check_foundation_files(): """ Checks that foundation-files exist. """ logger = bell_logger.setup_logger() try: for filepath in [ os.environ.get('BELL_CE__BELL_DICT_JSON_PATH'), os.environ.get('BELL_CE__AccToPidDict_JSON_PATH') ]: try: assert os.path.exists( filepath ) except Exception as e: message = 'Problem finding filepath %s; exception: %s' % ( filepath, unicode(repr(e)) ) logger.error( message ); raise Exception( message ) task_manager.update_tracker( key='GENERAL', message='foundation files ok' ) next = task_manager.determine_next_task( sys._getframe().f_code.co_name, logger=logger ) # job = q.enqueue_call ( func='%s' % next, args=(), timeout=30 ) logger.info( 'in check_environment.check_foundation_files(); files ok' ) return except Exception as e: message = 'in check_environment.check_foundation_files(); problem checking foundation files; exception: %s' % unicode(repr(e)) logger.error( message ) raise Exception( message )