Ejemplo n.º 1
0
    args = parser.parse_args()

    # Validate product_types
    if ((set(['landsat', 'plot']) == set(args.product_types)) or
            (set(['modis', 'plot']) == set(args.product_types)) or
            (set(['landsat', 'modis', 'plot']) == set(args.product_types))):
        print("Invalid --product-types: 'plot' cannot be combined with any"
              " other product types")
        sys.exit(1)

    # Configure and get the logger for this task
    if 'plot' in args.product_types:
        logger_name = 'espa.cron.plot'
    else:
        logger_name = '.'.join(['espa.cron', args.priority.lower()])
    EspaLogging.configure(logger_name)
    logger = EspaLogging.get_logger(logger_name)

    # Check required variables that this script should fail on if they are not
    # defined
    required_vars = ['ESPA_XMLRPC', 'ESPA_WORK_DIR', 'LEDAPS_AUX_DIR',
                     'L8_AUX_DIR', 'PATH', 'HOME']
    for env_var in required_vars:
        if (env_var not in os.environ or os.environ.get(env_var) is None or
                len(os.environ.get(env_var)) < 1):

            logger.critical("$%s is not defined... exiting" % env_var)
            sys.exit(1)

    # Determine the appropriate priority value to use for the queue and request
    queue_priority = args.priority.lower()
Ejemplo n.º 2
0
        logger.exception("An error occurred finalizing orders")

    finally:
        server = None
# END - determine_order_disposition


# ============================================================================
if __name__ == '__main__':
    '''
    Description:
      Execute the order disposition determination routine.
    '''

    # Configure and get the logger for this task
    EspaLogging.configure(LOGGER_NAME)
    logger = EspaLogging.get_logger(LOGGER_NAME)

    # Check required variables that this script should fail on if they are not
    # defined
    required_vars = ['ESPA_XMLRPC']
    for env_var in required_vars:
        if (env_var not in os.environ or os.environ.get(env_var) is None
                or len(os.environ.get(env_var)) < 1):

            logger.critical("$%s is not defined... exiting" % env_var)
            sys.exit(EXIT_FAILURE)

    try:
        determine_order_disposition()
    except Exception, e: