mirror of
https://github.com/wassname/ray.git
synced 2026-09-10 12:38:43 +08:00
[tune] Component notification on node failure + Tests (#3414)
Changes include: - Notify Components on Requeue - Slight refactoring of Node Failure handling - Better tests
This commit is contained in:
@@ -216,17 +216,19 @@ class Trial(object):
|
||||
|
||||
return False
|
||||
|
||||
def should_checkpoint(self, result):
|
||||
def should_checkpoint(self):
|
||||
"""Whether this trial is due for checkpointing."""
|
||||
result = self.last_result or {}
|
||||
|
||||
if result.get(DONE) and self.checkpoint_at_end:
|
||||
return True
|
||||
|
||||
if not self.checkpoint_freq:
|
||||
if self.checkpoint_freq:
|
||||
return result.get(TRAINING_ITERATION,
|
||||
0) % self.checkpoint_freq == 0
|
||||
else:
|
||||
return False
|
||||
|
||||
return self.last_result[TRAINING_ITERATION] % self.checkpoint_freq == 0
|
||||
|
||||
def progress_string(self):
|
||||
"""Returns a progress message for printing out to the console."""
|
||||
|
||||
@@ -281,10 +283,12 @@ class Trial(object):
|
||||
def should_recover(self):
|
||||
"""Returns whether the trial qualifies for restoring.
|
||||
|
||||
This is if a checkpoint frequency is set, which includes settings
|
||||
where there may not yet be a checkpoint.
|
||||
This is if a checkpoint frequency is set and has not failed more than
|
||||
max_failures. This may return true even when there may not yet
|
||||
be a checkpoint.
|
||||
"""
|
||||
return self.checkpoint_freq > 0
|
||||
return (self.checkpoint_freq > 0
|
||||
and self.num_failures < self.max_failures)
|
||||
|
||||
def update_last_result(self, result, terminate=False):
|
||||
if terminate:
|
||||
|
||||
Reference in New Issue
Block a user