mirror of
https://github.com/wassname/ray.git
synced 2026-07-18 12:40:56 +08:00
[tune] check for running session (#10840)
This commit is contained in:
@@ -400,6 +400,18 @@ class FunctionApiTest(unittest.TestCase):
|
||||
trial_dfs = list(analysis.trial_dataframes.values())
|
||||
assert len(trial_dfs[0]["training_iteration"]) == 10
|
||||
|
||||
def testEnabled(self):
|
||||
def train(config, checkpoint_dir=None):
|
||||
is_active = tune.is_session_enabled()
|
||||
if is_active:
|
||||
tune.report(active=is_active)
|
||||
return is_active
|
||||
|
||||
assert train({}) is False
|
||||
analysis = tune.run(train)
|
||||
t = analysis.trials[0]
|
||||
assert t.last_result["active"]
|
||||
|
||||
def testBlankCheckpoint(self):
|
||||
def train(config, checkpoint_dir=None):
|
||||
restored = bool(checkpoint_dir)
|
||||
|
||||
Reference in New Issue
Block a user