From e659699ca9dce90d2bb361ca9363ff97853cd28d Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Mon, 27 Jan 2020 15:53:40 -0800 Subject: [PATCH] [tune] Fix directory naming regression (#6839) --- doc/source/rllib-training.rst | 2 +- python/ray/tune/tests/test_trial_runner.py | 3 ++- python/ray/tune/tests/test_tune_save_restore.py | 2 ++ python/ray/tune/trial.py | 3 ++- python/ray/tune/tune.py | 2 +- rllib/agents/trainer.py | 6 +++--- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/source/rllib-training.rst b/doc/source/rllib-training.rst index d38f2f06c..b52e66d24 100644 --- a/doc/source/rllib-training.rst +++ b/doc/source/rllib-training.rst @@ -180,7 +180,7 @@ Tune will schedule the trials to run in parallel on your Ray cluster: Custom Training Workflows ~~~~~~~~~~~~~~~~~~~~~~~~~ -In the `basic training example `__, Tune will call ``train()`` on your trainer once per iteration and report the new training results. Sometimes, it is desirable to have full control over training, but still run inside Tune. Tune supports `custom trainable functions `__ that can be used to implement `custom training workflows (example) `__. +In the `basic training example `__, Tune will call ``train()`` on your trainer once per training iteration and report the new training results. Sometimes, it is desirable to have full control over training, but still run inside Tune. Tune supports `custom trainable functions `__ that can be used to implement `custom training workflows (example) `__. For even finer-grained control over training, you can use RLlib's lower-level `building blocks `__ directly to implement `fully customized training workflows `__. diff --git a/python/ray/tune/tests/test_trial_runner.py b/python/ray/tune/tests/test_trial_runner.py index ea797a28b..9a50a88d5 100644 --- a/python/ray/tune/tests/test_trial_runner.py +++ b/python/ray/tune/tests/test_trial_runner.py @@ -1,3 +1,4 @@ +import os import sys import unittest @@ -57,7 +58,7 @@ class TrialRunnerTest(unittest.TestCase): trial_generator.add_configurations({name: spec}) for trial in trial_generator.next_trials(): trial_executor.start_trial(trial) - self.assertLessEqual(len(trial.logdir), 200) + self.assertLessEqual(len(os.path.basename(trial.logdir)), 200) trial_executor.stop_trial(trial) def testExtraResources(self): diff --git a/python/ray/tune/tests/test_tune_save_restore.py b/python/ray/tune/tests/test_tune_save_restore.py index 9a5e0f476..5b476ecdf 100644 --- a/python/ray/tune/tests/test_tune_save_restore.py +++ b/python/ray/tune/tests/test_tune_save_restore.py @@ -47,6 +47,8 @@ class SerialTuneRelativeLocalDirTest(unittest.TestCase): _register_all() def _get_trial_dir(self, absoulte_exp_dir): + print("looking for", self.MockTrainable._name) + print("in", os.listdir(absoulte_exp_dir)) trial_dirname = next( (child_dir for child_dir in os.listdir(absoulte_exp_dir) if (os.path.isdir(os.path.join(absoulte_exp_dir, child_dir)) diff --git a/python/ray/tune/trial.py b/python/ray/tune/trial.py index 35731cdf9..a7bfbbd4e 100644 --- a/python/ray/tune/trial.py +++ b/python/ray/tune/trial.py @@ -270,7 +270,8 @@ class Trial: """Init logger.""" if not self.result_logger: if not self.logdir: - self.logdir = Trial.create_logdir(str(self), self.local_dir) + self.logdir = Trial.create_logdir( + str(self) + "_" + self.experiment_tag, self.local_dir) else: os.makedirs(self.logdir, exist_ok=True) diff --git a/python/ray/tune/tune.py b/python/ray/tune/tune.py index 202c6eb41..305ff832a 100644 --- a/python/ray/tune/tune.py +++ b/python/ray/tune/tune.py @@ -362,7 +362,7 @@ def run_experiments(experiments, reuse_actors=False, trial_executor=None, raise_on_failed_trial=True, - concurrent=False): + concurrent=True): """Runs and blocks until all trials finish. Examples: diff --git a/rllib/agents/trainer.py b/rllib/agents/trainer.py index 1e8f5604a..644f2a33a 100644 --- a/rllib/agents/trainer.py +++ b/rllib/agents/trainer.py @@ -210,7 +210,7 @@ COMMON_CONFIG = { # Whether to LZ4 compress individual observations "compress_observations": False, # Wait for metric batches for at most this many seconds. Those that - # have not returned in time will be collected in the next iteration. + # have not returned in time will be collected in the next train iteration. "collect_metrics_timeout": 180, # Smooth metrics over this many episodes. "metrics_smoothing_episodes": 100, @@ -224,10 +224,10 @@ COMMON_CONFIG = { # but optimal value could be obtained by measuring your environment # step / reset and model inference perf. "remote_env_batch_wait_ms": 0, - # Minimum time per iteration + # Minimum time per train iteration "min_iter_time_s": 0, # Minimum env steps to optimize for per train call. This value does - # not affect learning, only the length of iterations. + # not affect learning, only the length of train iterations. "timesteps_per_iteration": 0, # This argument, in conjunction with worker_index, sets the random seed of # each worker, so that identically configured trials will have identical