Skip to content

Commit 94c16b0

Browse files
committed
cli: change torchx color to blue and fix for closed stdout
1 parent 2d3a981 commit 94c16b0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

torchx/cli/colors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
import sys
99

1010
# only print colors if outputting directly to a terminal
11-
if sys.stdout.isatty():
11+
if not sys.stdout.closed and sys.stdout.isatty():
1212
GREEN = "\033[32m"
13+
BLUE = "\033[34m"
1314
ORANGE = "\033[38:2:238:76:44m"
1415
GRAY = "\033[2m"
1516
ENDC = "\033[0m"
1617
else:
1718
GREEN = ""
1819
ORANGE = ""
20+
BLUE = ""
1921
GRAY = ""
2022
ENDC = ""

torchx/cli/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from torchx.cli.cmd_run import CmdBuiltins, CmdRun
1818
from torchx.cli.cmd_runopts import CmdRunopts
1919
from torchx.cli.cmd_status import CmdStatus
20-
from torchx.cli.colors import ENDC, GRAY, ORANGE
20+
from torchx.cli.colors import ENDC, GRAY, BLUE
2121
from torchx.util.entrypoints import load_group
2222

2323

@@ -97,7 +97,7 @@ def run_main(subcmds: Dict[str, SubCommand], argv: List[str] = sys.argv[1:]) ->
9797
args = parser.parse_args(argv)
9898
logging.basicConfig(
9999
level=args.log_level,
100-
format=f"{ORANGE}torchx{ENDC} {GRAY}%(asctime)s %(levelname)-8s{ENDC} %(message)s",
100+
format=f"{BLUE}torchx{ENDC} {GRAY}%(asctime)s %(levelname)-8s{ENDC} %(message)s",
101101
datefmt="%Y-%m-%d %H:%M:%S",
102102
)
103103
if "func" not in args:

0 commit comments

Comments
 (0)