Example #1
0
def main():
    """
    Main function to put the pieces together and run the recipe
    """
    # NOTE: not allow GDAL to create auxilary file which causes problem when no permission on the input data folder
    command = "export GDAL_PAM_ENABLED=NO"
    os.system(command)

    reg = RecipeRegistry()
    validate()
    try:
        ingredients = decode_ingredients(read_ingredients())
        hooks = ingredients["hooks"] if "hooks" in ingredients else None
        session = Session(ingredients['config'], ingredients['input'],
                          ingredients['recipe'], hooks,
                          os.path.basename(sys.argv[1]),
                          FileUtil.get_directory_path(sys.argv[1]))
        reg.run_recipe(session)
    except RecipeValidationException as re:
        log.error(str(re))
        exit_error()
    except RuntimeException as re:
        log.error(str(re))
        exit_error()
    except WCSTException as re:
        log.error(str(re))
        exit_error()
    except Exception as ex:
        log.error(
            "An error has occured in the execution of the program. Error Message: "
            + str(ex) + "\nStack Trace: " + traceback.format_exc())
        exit_error()
Example #2
0
def main():
    """
    Main function to put the pieces together and run the recipe
    """
    reg = RecipeRegistry()
    validate()
    try:
        ingredients = decode_ingredients(read_ingredients())
        session = Session(ingredients['config'], ingredients['input'], ingredients['recipe'],
                          os.path.basename(sys.argv[1]),
                          FileUtil.get_directory_path(sys.argv[1]))
        reg.run_recipe(session)
    except RecipeValidationException as re:
        log.error(str(re))
        exit_error()
    except RuntimeException as re:
        log.error(str(re))
        exit_error()
    except WCSTException as re:
        log.error(str(re))
        exit_error()
    except Exception as ex:
        log.error("An error has occured in the execution of the program. Error Message: " + str(
            ex) + "\nStack Trace: " + traceback.format_exc())
        exit_error()
Example #3
0
def main():
    """
    Main function to put the pieces together and run the recipe
    """
    # NOTE: not allow GDAL to create auxilary file which causes problem when no permission on the input data folder
    command = "export GDAL_PAM_ENABLED=NO"
    os.system(command)

    reg = RecipeRegistry()
    validate()

    # Parse input arguments from command line
    arguments = parse_arguments()
    ingredients_file_path = arguments.ingredients_file

    ConfigManager.user = arguments.user
    ConfigManager.passwd = arguments.passwd

    if arguments.identity_file is not None:
        key_value = FileUtil.read_file_to_string(arguments.identity_file)
        if ":" not in key_value:
            raise RuntimeException(
                "credentials in the identity file '" +
                arguments.identity_file + "' "
                "must be specified in the file as username:password")
        tmps = key_value.split(":")
        ConfigManager.user = tmps[0].strip()
        ConfigManager.passwd = tmps[1].strip()

    try:
        ingredients = decode_ingredients(
            read_ingredients(ingredients_file_path))
        hooks = ingredients["hooks"] if "hooks" in ingredients else None
        session = Session(ingredients['config'], ingredients['input'],
                          ingredients['recipe'], hooks,
                          os.path.basename(ingredients_file_path),
                          FileUtil.get_directory_path(ingredients_file_path))
        reg.run_recipe(session)
    except RecipeValidationException as re:
        log.error(str(re))
        exit_error()
    except RuntimeException as re:
        log.error(str(re))
        exit_error()
    except WCSTException as re:
        log.error(str(re))
        exit_error()
    except Exception as ex:
        log.error(
            "An error has occured in the execution of the program. Error Message: "
            + str(ex) + "\nStack Trace: " + traceback.format_exc())
        exit_error()
Example #4
0
def main():
    """
    Main function to put the pieces together and run the recipe
    """
    reg = RecipeRegistry()
    validate()
    try:
        ingredients = decode_ingredients(read_ingredients())
        session = Session(ingredients['config'], ingredients['input'], ingredients['recipe'],
                          FileUtil.get_directory_path(sys.argv[1]))
        reg.run_recipe(session)
    except RecipeValidationException as re:
        log.error(str(re))
        exit_error()
    except RuntimeException as re:
        log.error(str(re))
        exit_error()
    except WCSTException as re:
        log.error(str(re))
        exit_error()
    except Exception as ex:
        log.error("An error has occured in the execution of the program. Error Message: " + str(
            ex) + "\nStack Trace: " + traceback.format_exc())
        exit_error()