mirror of
https://github.com/wassname/ray.git
synced 2026-08-09 12:20:09 +08:00
[tune] Cluster Fault Tolerance (#3309)
This PR introduces cluster-level fault tolerance for Tune by checkpointing global state. This occurs with relatively high frequency and allows users to easily resume experiments when the cluster crashes. Note that this PR may affect automated workflows due to auto-prompting, but this is resolvable.
This commit is contained in:
@@ -4,11 +4,11 @@ from __future__ import print_function
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import os
|
||||
import six
|
||||
import types
|
||||
|
||||
from ray.tune.error import TuneError
|
||||
from ray.tune.log_sync import validate_sync_function
|
||||
from ray.tune.registry import register_trainable
|
||||
from ray.tune.result import DEFAULT_RESULTS_DIR
|
||||
|
||||
@@ -122,7 +122,6 @@ class Experiment(object):
|
||||
restore=None,
|
||||
repeat=None,
|
||||
trial_resources=None):
|
||||
validate_sync_function(sync_function)
|
||||
if sync_function:
|
||||
assert upload_dir, "Need `upload_dir` if sync_function given."
|
||||
|
||||
@@ -134,16 +133,16 @@ class Experiment(object):
|
||||
resources_per_trial = trial_resources
|
||||
|
||||
spec = {
|
||||
"run": self._register_if_needed(run),
|
||||
"run": Experiment._register_if_needed(run),
|
||||
"stop": stop or {},
|
||||
"config": config or {},
|
||||
"resources_per_trial": resources_per_trial,
|
||||
"num_samples": num_samples,
|
||||
"local_dir": local_dir or DEFAULT_RESULTS_DIR,
|
||||
"local_dir": os.path.expanduser(local_dir or DEFAULT_RESULTS_DIR),
|
||||
"upload_dir": upload_dir or "", # argparse converts None to "null"
|
||||
"trial_name_creator": trial_name_creator,
|
||||
"custom_loggers": custom_loggers,
|
||||
"sync_function": sync_function or "", # See `upload_dir`.
|
||||
"sync_function": sync_function,
|
||||
"checkpoint_freq": checkpoint_freq,
|
||||
"checkpoint_at_end": checkpoint_at_end,
|
||||
"max_failures": max_failures,
|
||||
@@ -180,7 +179,8 @@ class Experiment(object):
|
||||
raise TuneError("Improper argument from JSON: {}.".format(spec))
|
||||
return exp
|
||||
|
||||
def _register_if_needed(self, run_object):
|
||||
@classmethod
|
||||
def _register_if_needed(cls, run_object):
|
||||
"""Registers Trainable or Function at runtime.
|
||||
|
||||
Assumes already registered if run_object is a string. Does not
|
||||
|
||||
Reference in New Issue
Block a user