예제 #1
0
def init(blueprint_path,
         inputs,
         install_plugins_):
    if os.path.isdir(_storage_dir()):
        shutil.rmtree(_storage_dir())

    if not utils.is_initialized():
        aria.init(reset_config=False, skip_logging=True)
    try:
        common.initialize_blueprint(
            blueprint_path=blueprint_path,
            name=_NAME,
            inputs=inputs,
            storage=_storage(),
            install_plugins=install_plugins_,
            resolver=utils.get_import_resolver()
        )
    except ImportError as e:
        e.possible_solutions = [
            "Run 'aria init --install-plugins -p {0}'"
            .format(blueprint_path),
            "Run 'aria install-plugins -p {0}'"
            .format(blueprint_path)
        ]
        raise

    logger.get_logger().info(
        "Initiated {0}\nIf you make changes to the "
        "blueprint, "
        "Run 'aria init -p {0}' "
        "again to apply them"
        .format(blueprint_path))
예제 #2
0
def init(blueprint_id,
         blueprint_path,
         inputs,
         install_plugins_):
    print("Staring blueprint initialization.")
    aria_api = api.AriaCoreAPI()
    if os.path.isdir(utils.storage_dir(blueprint_id)):
        shutil.rmtree(utils.storage_dir(blueprint_id))

    if not utils.is_initialized():
        aria_cli.init(reset_config=False, skip_logging=True)

    try:
        if install_plugins_:
            requirements = aria_api.blueprints.create_requirements(
                blueprint_path=blueprint_path
            )
            print_utils.print_dict({'requirements': '\n'.join(requirements)})
        aria_api.blueprints.initialize(
            blueprint_id,
            blueprint_path,
            inputs=inputs,
            install_plugins=install_plugins_,
        )
    except BaseException as e:
        e.possible_solutions = [
            "Run 'aria init --install-plugins -p {0} -b {1}'"
            .format(blueprint_path,
                    blueprint_id)
        ]
        LOG.exception(str(e))
        print(str(e))
        raise e

    msg = (
        "Initiated {0}\nIf you make changes to the "
        "blueprint, "
        "Run 'aria init -b {1} -p {0}' "
        "again to apply them"
        .format(blueprint_path, blueprint_id))
    LOG.info(msg)
    print(msg)
예제 #3
0
def init(blueprint_path,
         inputs,
         install_plugins_):
    if os.path.isdir(_storage_dir()):
        shutil.rmtree(_storage_dir())

    if not utils.is_initialized():
        aria_init.init(reset_config=False, skip_logging=True)
    try:
        common.initialize_blueprint(
            blueprint_path=blueprint_path,
            name=_NAME,
            inputs=inputs,
            storage=_storage(),
            install_plugins=install_plugins_,
            resolver=utils.get_import_resolver()
        )
    except ImportError as e:

        # import error indicates
        # some plugin modules are missing
        # TODO - consider adding an error code to
        # TODO - all of our exceptions. so that we
        # TODO - easily identify them here
        e.possible_solutions = [
            "Run 'aria init --install-plugins -p {0}'"
            .format(blueprint_path),
            "Run 'aria install-plugins -p {0}'"
            .format(blueprint_path)
        ]
        raise

    get_logger().info("Initiated {0}\nIf you make changes to the "
                      "blueprint, "
                      "run 'aria init -p {0}' "
                      "again to apply them"
                      .format(blueprint_path))