Repository: ray-project/ray
File: python/ray/serve/scripts.py (Python)

Code before:
    arguments: Tuple[str],
    runtime_env: str,
    runtime_env_json: str,
    working_dir: str,
    name: Optional[str],
    address: str,
):
    args_dict = convert_args_to_dict(arguments)
    final_runtime_env = parse_runtime_env_args(
        runtime_env=runtime_env,
        runtime_env_json=runtime_env_json,
        working_dir=working_dir,
    )

    config = _generate_config_from_file_or_import_path(
        config_or_import_path,
        name=name,
        arguments=args_dict,
        runtime_env=final_runtime_env,
    )

    submission_client = ServeSubmissionClient(address)
    serve_details = ServeInstanceDetails(**submission_client.get_serve_details())
    _validate_deployment_config(serve_details, config)

    submission_client.deploy_applications(
        config.dict(exclude_unset=True),
    )
    cli_logger.success(
        "\nSent deploy request successfully.\n "
        "* Use `serve status` to check applications' statuses.\n "
        "* Use `serve config` to see the current application config(s).\n"
    )


@cli.command(
    short_help="Run an application or group of applications.",
    help=(
        "Run an application from an import path (e.g., my_script:"
        "app) or a group of applications from a YAML config file.\n\n"
        "Passed import paths must point to an Application object or "
        "a function that returns one. If a function is used, arguments can be "
        "passed to it in 'key=val' format after the import path, for example:\n\n"
        "serve run my_script:app model_path='/path/to/model.pkl' num_replicas=5\n\n"
        "If passing a YAML config, existing applications with no code changes will not "
        "be updated.\n\n"
        "By default, this will block and stream logs to the console. If you "
        "Ctrl-C the command, it will shut down Serve on the cluster."
    ),
)
@click.argument("config_or_import_path")

Review comment (suggestion):
if we make change at this layer, then still PUT API call will be ignoring the warning errors(this change works for serve deploy only), shouldn't we put this validation behind the API? as soon as we intercept the PUT request

Code after:
@click.option(
    "--runtime-env-json",
    type=str,
    default=None,
    required=False,
    help="JSON-serialized runtime_env dictionary. This will be passed to "
    "ray.init() as the default for deployments.",
)
@click.option(
    "--working-dir",
    type=str,
    default=None,
    required=False,
    help=(
        "Directory containing files that your application(s) will run in. Can be a "
        "local directory or a remote URI to a .zip file (S3, GS, HTTP). "
        "This overrides the working_dir in --runtime-env if both are "
        "specified. This will be passed to ray.init() as the default for "
        "deployments."
    ),
)
@click.option(
    "--app-dir",
    "-d",
    default=".",
    type=str,
    help=APP_DIR_HELP_STR,
)
@click.option(
    "--address",
    "-a",
    default=os.environ.get("RAY_ADDRESS", None),
    required=False,
    type=str,
    help=RAY_INIT_ADDRESS_HELP_STR,
)
@click.option(
    "--blocking/--non-blocking",
    default=True,
    help=(
        "Whether or not this command should be blocking. If blocking, it "
        "will loop and log status until Ctrl-C'd, then clean up the app."
    ),
)
@click.option(
    "--reload",
    "-r",
    is_flag=True,
    help=(
        "This is an experimental feature - Listens for changes to files in the working directory, "
        "--working-dir or the working_dir in the --runtime-env, and automatically redeploys "