[tune] Fix directory naming regression (#6839)

This commit is contained in:
Eric Liang
2020-01-27 15:53:40 -08:00
committed by GitHub
parent d9a2294298
commit e659699ca9
6 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -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 <https://github.com/ray-project/ray/blob/master/rllib/examples/custom_env.py>`__, 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 <tune-usage.html#trainable-api>`__ that can be used to implement `custom training workflows (example) <https://github.com/ray-project/ray/blob/master/rllib/examples/custom_train_fn.py>`__.
In the `basic training example <https://github.com/ray-project/ray/blob/master/rllib/examples/custom_env.py>`__, 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 <tune-usage.html#trainable-api>`__ that can be used to implement `custom training workflows (example) <https://github.com/ray-project/ray/blob/master/rllib/examples/custom_train_fn.py>`__.
For even finer-grained control over training, you can use RLlib's lower-level `building blocks <rllib-concepts.html>`__ directly to implement `fully customized training workflows <https://github.com/ray-project/ray/blob/master/rllib/examples/rollout_worker_custom_workflow.py>`__.
+2 -1
View File
@@ -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):
@@ -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))
+2 -1
View File
@@ -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)
+1 -1
View File
@@ -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:
+3 -3
View File
@@ -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