Пример #1
0
def process_shake(event_id=None):
    LOGGER.info('-------------------------------------------')

    if 'INASAFE_LOCALE' in os.environ:
        locale_option = os.environ['INASAFE_LOCALE']
    else:
        locale_option = 'en'

    working_directory = EARTHQUAKE_WORKING_DIRECTORY

    if not check_event_exists(event_id):
        LOGGER.info('Shake grid not exists')
        return False

    try:
        process_event(working_directory, event_id, locale_option)
        LOGGER.info('Process event end.')
        return True
    except Exception as e:
        LOGGER.exception(e)

    return False
Пример #2
0
def process_shake(event_id=None):
    LOGGER.info("-------------------------------------------")

    if "INASAFE_LOCALE" in os.environ:
        locale_option = os.environ["INASAFE_LOCALE"]
    else:
        locale_option = "en"

    working_directory = EARTHQUAKE_WORKING_DIRECTORY

    if not check_event_exists(event_id):
        LOGGER.info("Shake grid not exists")
        return False

    try:
        process_event(working_directory, event_id, locale_option)
        LOGGER.info("Process event end.")
        return True
    except Exception as e:
        LOGGER.exception(e)

    return False
 def process_shakemap(shake_id=None):
     """Process a given shake_id for realtime shake"""
     LOGGER.info('Inotify received new shakemap')
     tz = get_localzone()
     notify_realtime_rest(datetime.datetime.now(tz=tz))
     done = False
     while not done:
         try:
             done = process_event(working_dir=working_dir,
                                  event_id=shake_id,
                                  locale=locale_option)
         except Exception as e:  # pylint: disable=W0702
             LOGGER.info('Process event failed')
             LOGGER.exception(e)
             LOGGER.info('Retrying to process event')
     LOGGER.info('Shakemap %s handled' % (shake_id, ))
Пример #4
0
 def process_shakemap(shake_id=None):
     """Process a given shake_id for realtime shake"""
     LOGGER.info('Inotify received new shakemap')
     tz = get_localzone()
     notify_realtime_rest(datetime.datetime.now(tz=tz))
     done = False
     while not done:
         try:
             done = process_event(
                 working_dir=working_dir,
                 event_id=shake_id,
                 locale=locale_option)
         except Exception as e:  # pylint: disable=W0702
             LOGGER.info('Process event failed')
             LOGGER.exception(e)
             LOGGER.info('Retrying to process event')
     LOGGER.info('Shakemap %s handled' % (shake_id, ))