[serve] Remove logic to automatically infer conda env name (#17639)

This commit is contained in:
Edward Oakes 2021-08-06 13:27:23 -05:00 committed by GitHub
parent b173b33934
commit 57b190c987
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,9 +3,7 @@ import atexit
import collections
import inspect
import logging
import os
import re
import sys
import time
from dataclasses import dataclass
from functools import wraps
@ -330,21 +328,6 @@ class Client:
if ray_actor_options is None:
ray_actor_options = {}
# If conda is activated and a conda env is not specified in runtime_env
# in ray_actor_options, default to conda env of this process (client).
# Without this code, the backend would run in the controller's conda
# env, which is likely different from that of the client.
# If using Ray client, skip this convenience feature because the local
# client env doesn't create the Ray cluster (so the client env is
# likely not present on the cluster.)
if not ray.util.client.ray.is_connected() and sys.platform != "win32":
if ray_actor_options.get("runtime_env") is None:
ray_actor_options["runtime_env"] = {}
if ray_actor_options["runtime_env"].get("conda") is None:
current_env = os.environ.get("CONDA_DEFAULT_ENV")
if current_env is not None and current_env != "":
ray_actor_options["runtime_env"]["conda"] = current_env
replica_config = ReplicaConfig(
backend_def, *init_args, ray_actor_options=ray_actor_options)