[Core] Warn when failed to get the exact version of pickle5 (#10731)

* warn when failed to get the exact version of pickle5

* add missing spaces
This commit is contained in:
Siyuan (Ryans) Zhuang
2020-09-15 11:21:27 -07:00
committed by GitHub
parent 4ccfd07a61
commit c2dff126aa
+13 -6
View File
@@ -11,12 +11,19 @@ logger = logging.getLogger(__name__)
if "pickle5" in sys.modules:
import pkg_resources
version_info = pkg_resources.require("pickle5")
version = tuple(int(n) for n in version_info[0].version.split("."))
if version < (0, 0, 10):
raise ImportError("You are using an old version of pickle5 that "
"leaks memory, please run 'pip install pickle5 -U' "
"to upgrade")
try:
version_info = pkg_resources.require("pickle5")
version = tuple(int(n) for n in version_info[0].version.split("."))
if version < (0, 0, 10):
raise ImportError("You are using an old version of pickle5 "
"that leaks memory, please run "
"'pip install pickle5 -U' to upgrade")
except pkg_resources.DistributionNotFound:
logger.warning("You are using the 'pickle5' module, but "
"the exact version is unknown (possibly carried as "
"an internal component by another module). Please "
"make sure you are using pickle5 >= 0.0.10 because "
"previous versions may leak memory.")
if "OMP_NUM_THREADS" not in os.environ:
logger.debug("[ray] Forcing OMP_NUM_THREADS=1 to avoid performance "