Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes to allow tune/tests/test_commands.py to run on windows #21342

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions python/ray/tune/commands.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import click
import logging
import operator
import os
import shutil
import subprocess
import operator
from datetime import datetime

import pandas as pd
Expand Down Expand Up @@ -30,11 +31,7 @@
"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,
Expand Down
5 changes: 3 additions & 2 deletions rllib/agents/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,9 @@ def log_result(self, result: ResultDict) -> None:
@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()
Expand Down