Example #1
0
def deploy(config_file, manager_path, check, dry_run):
    """Deploy polyaxon."""
    config = read_deployment_config(config_file)
    manager = DeployManager(config=config,
                            filepath=config_file,
                            manager_path=manager_path,
                            dry_run=dry_run)
    exception = None
    if check:
        try:
            manager.check()
        except Exception as e:
            handle_cli_error(e,
                             message="Polyaxon deployment file is not valid.")
            sys.exit(1)

        Printer.print_success("Polyaxon deployment file is valid.")
    else:
        try:
            manager.install()
        except Exception as e:
            Printer.print_error("Polyaxon could not be installed.")
            exception = e

    if exception:
        Printer.print_error("Error message: {}.".format(exception))
Example #2
0
def deploy(config_file, deployment_type, manager_path, check, dry_run):
    """Deploy polyaxon."""
    config = read_deployment_config(config_file)
    manager = DeployManager(
        config=config,
        filepath=config_file,
        deployment_type=deployment_type,
        manager_path=manager_path,
        dry_run=dry_run,
    )
    exception = None
    if config:
        Printer.print_success("Polyaxon `{}` deployment file is valid.".format(
            config.deployment_chart))
    if check:
        try:
            manager.check()
        except Exception as e:
            handle_cli_error(e,
                             message="Polyaxon deployment manager error.",
                             sys_exit=True)

    else:
        try:
            manager.install()
        except Exception as e:
            Printer.print_error("Polyaxon could not be installed.")
            exception = e

    if exception:
        Printer.print_error("Error message: {}.".format(exception),
                            sys_exit=True)