mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[tune] fixes to allow tune/tests/test_commands.py to run on windows (#21342)
tune does not run smoothly on Windows. This cleans up some blockers: - use cross-platform shutils.get_terminal_size instead of Popen(stty) - somehow Trainer.workers is None at the end of test_commands.py, so the cleanup command was erroring. The error was not fatal, but was printing in the logs. - if run locally, the log files are all written to the same location, so the rync-based syncing solution is not needed. This is the real fix for issue #20747
This commit is contained in:
parent
45cddef2d3
commit
ec6a33b736
2 changed files with 7 additions and 9 deletions
|
@ -1,8 +1,9 @@
|
|||
import click
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import operator
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
|
||||
import pandas as pd
|
||||
|
@ -30,11 +31,7 @@ DEFAULT_PROJECT_INFO_KEYS = (
|
|||
"last_updated",
|
||||
)
|
||||
|
||||
try:
|
||||
TERM_HEIGHT, TERM_WIDTH = subprocess.check_output(["stty", "size"]).split()
|
||||
TERM_HEIGHT, TERM_WIDTH = int(TERM_HEIGHT), int(TERM_WIDTH)
|
||||
except subprocess.CalledProcessError:
|
||||
TERM_HEIGHT, TERM_WIDTH = 100, 100
|
||||
TERM_WIDTH, TERM_HEIGHT = shutil.get_terminal_size(fallback=(100, 100))
|
||||
|
||||
OPERATORS = {
|
||||
"<": operator.lt,
|
||||
|
|
|
@ -1848,8 +1848,9 @@ class Trainer(Trainable):
|
|||
@override(Trainable)
|
||||
def cleanup(self) -> None:
|
||||
# Stop all workers.
|
||||
if hasattr(self, "workers"):
|
||||
self.workers.stop()
|
||||
workers = getattr(self, "workers", None)
|
||||
if workers:
|
||||
workers.stop()
|
||||
# Stop all optimizers.
|
||||
if hasattr(self, "optimizer") and self.optimizer:
|
||||
self.optimizer.stop()
|
||||
|
|
Loading…
Add table
Reference in a new issue