Example #1
0
def cli(context, verbose, offline):
    """Polyaxon - Cloud Native Machine Learning Automation & Experimentation tool.

    This CLI provides tools to:

      - Parse, Validate, and Check Polyaxonfiles.

      - Interact with Polyaxon server.

      - Run and Monitor experiments and jobs.

    This CLI tool comes with a caching mechanism:

      - You can initialize a project with: polyaxon init [project name]

      - Otherwise Polyaxon will the default global path will be used for the cache.

    You can check the version of you CLI by running:

      - polyaxon version

    To Enable debug mode, you can use the `-v` flag:

      - polyaxon -v admin

    Common commands:

      - polyaxon project get

      - polyaxon run [-f] [-l]

      - polyaxon ops ls

      - polyaxon ops get

      - polyaxon config -l

      - polyaxon config set ...

    Admin deployment commands:

      - polyaxon admin deploy [-f] [--check]

      - polyaxon admin upgrade [-f] [--check]

      - polyaxon admin teardown [-f]

    For more information, please visit https://polyaxon.com/docs/core/cli/

    Check the help available for each command listed below.
    """
    settings.set_cli_config()
    configure_logger(verbose)
    non_check_cmds = [
        "completion",
        "config",
        "version",
        "login",
        "logout",
        "deploy",
        "admin",
        "teardown",
        "docker",
        "initializer",
        "sidecar",
        "proxy",
        "notify",
        "upgrade",
        "port-forward",
    ]
    context.obj = context.obj or {}
    if not settings.CLIENT_CONFIG.client_header:
        settings.CLIENT_CONFIG.set_cli_header()
    context.obj["offline"] = offline
    if offline:
        os.environ["POLYAXON_IS_OFFLINE"] = "true"
        settings.CLIENT_CONFIG.is_offline = True
    if not (context.invoked_subcommand in non_check_cmds or offline
            or settings.CLIENT_CONFIG.no_api or settings.CLIENT_CONFIG.is_ops
            or DOCS_GEN) and settings.CLI_CONFIG.should_check(
                settings.CLIENT_CONFIG.compatibility_check_interval):
        cli_config = set_versions_config()
        check_cli_version(cli_config)
Example #2
0
def cli(context, verbose, offline):
    """Polyaxon - Cloud Native Machine Learning Automation & Experimentation tool.

    This CLI provides tools to:

      - Parse, Validate, and Check Polyaxonfiles.

      - Interact with Polyaxon server.

      - Run and Monitor experiments and jobs.

    This CLI tool comes with a caching mechanism:

      - You can initialize a project with: polyaxon init -p [project name]

      - Otherwise Polyaxon will use the default global path for the cache.

    You can check the version of your CLI by running:

      - polyaxon version

    To can check the version of the CLI and the server, and check the compatibility matrix:

      - polyaxon version --check

    To Enable debug mode, you can use the `-v` flag:

      - polyaxon -v ...

    To configure your host:

      - polyaxon config set --host=...

    To check your current config:

      - polyaxon config show

    Common commands:

      - polyaxon project get

      - polyaxon run [-f] [-l]

      - polyaxon ops ls

      - polyaxon ops logs

      - polyaxon ops get

      - polyaxon config set ...

    Admin deployment commands:

      - polyaxon admin deploy [-f] [--check]

      - polyaxon admin upgrade [-f] [--check]

      - polyaxon admin teardown [-f]

    For more information, please visit https://polyaxon.com/docs/core/cli/

    Check the help available for each command listed below by appending `-h`.
    """
    settings.set_cli_config()
    configure_logger(verbose)
    if settings.CLIENT_CONFIG.no_op:
        Printer.print_warning(
            "POLYAXON_NO_OP is set to `true`, some commands will not function correctly."
        )
    context.obj = context.obj or {}
    if not settings.CLIENT_CONFIG.client_header:
        settings.CLIENT_CONFIG.set_cli_header()
    context.obj["offline"] = offline
    if offline:
        os.environ["POLYAXON_IS_OFFLINE"] = "true"
        settings.CLIENT_CONFIG.is_offline = True
    non_check_cmds = [
        "completion",
        "config",
        "version",
        "login",
        "logout",
        "deploy",
        "admin",
        "teardown",
        "docker",
        "initializer",
        "sidecar",
        "proxy",
        "notify",
        "upgrade",
        "port-forward",
    ]
    if not settings.CLI_CONFIG.installation:
        pass
    if (not (context.invoked_subcommand in non_check_cmds or offline
             or settings.CLIENT_CONFIG.no_api or settings.CLIENT_CONFIG.is_ops
             or DOCS_GEN) and not settings.CLI_CONFIG.installation):
        cli_config = set_versions_config(is_cli=False)
        settings.CLI_CONFIG = cli_config
        check_cli_version(cli_config, is_cli=False)