From aa7b861332c83c802037ee13f2207938e394e1a0 Mon Sep 17 00:00:00 2001 From: Richard Liaw Date: Wed, 25 Dec 2019 08:15:33 +0100 Subject: [PATCH] [minor][tune] Support Type Hinting for py3 (#6571) * fullargspec for new pyversion * fi --- docker/tune_test/Dockerfile | 2 +- python/ray/tune/function_runner.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/tune_test/Dockerfile b/docker/tune_test/Dockerfile index c90245cd2..b0d3eaf4d 100644 --- a/docker/tune_test/Dockerfile +++ b/docker/tune_test/Dockerfile @@ -6,7 +6,7 @@ FROM ray-project/base-deps # a test runner. RUN conda install -y numpy RUN pip install -U pip -RUN pip install -U https://ray-wheels.s3-us-west-2.amazonaws.com/latest/ray-0.9.0.dev-cp36-cp36m-manylinux1_x86_64.whl +RUN pip install -U https://ray-wheels.s3-us-west-2.amazonaws.com/latest/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl RUN pip install -U boto3 # We install this after the latest wheels -- this should not override the latest wheels. # Needed to run Tune example with a 'plot' call - which does not actually render a plot, but throws an error. diff --git a/python/ray/tune/function_runner.py b/python/ray/tune/function_runner.py index 2b99a5c4c..9a8218796 100644 --- a/python/ray/tune/function_runner.py +++ b/python/ray/tune/function_runner.py @@ -7,6 +7,7 @@ import time import inspect import threading import traceback +import sys from six.moves import queue from ray.tune import track @@ -248,7 +249,10 @@ def wrap_function(train_func): use_track = False try: - func_args = inspect.getargspec(train_func).args + if sys.version_info >= (3, 3): + func_args = inspect.getfullargspec(train_func).args + else: + func_args = inspect.getargspec(train_func).args use_track = ("reporter" not in func_args and len(func_args) == 1) if use_track: logger.info("tune.track signature detected.")