Skip to content

Commit c497683

Browse files
Kiuk Chungfacebook-github-bot
Kiuk Chung
authored andcommitted
fix broken test for cmd_status_test for python <= 3.8.5
Summary: For python versions <= 3.8.5 `print(f"{obj}")` doesn't actually call the `__repr__()` nor `__str__()` methods of the obj's class. Hence the `cmd_status_test.py` was failing for python <= 3.8.5. But since we claim to support python 3.8+ we need to fix this. Fix is straight forward, just explicitly call `str(appstate)` Reviewed By: d4l3k, tierex Differential Revision: D28661448 fbshipit-source-id: 4d1347c64f14344d894fabc5ccacdde2085d5b09
1 parent d5620fa commit c497683

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

torchx/cli/cmd_status.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from torchx.specs import api
1818
from torchx.specs.api import NONE
1919

20+
2021
_APP_STATUS_FORMAT_TEMPLATE = """Application:
2122
State: ${state}
2223
Num Restarts: ${num_restarts}
@@ -82,12 +83,12 @@ def format_replica_status(replica_status: api.ReplicaStatus) -> str:
8283
exitcode = error_data["message"]["errorCode"]
8384
if not exitcode:
8485
exitcode = "<N/A>"
85-
data = f"""{replica_status.state} (exitcode: {exitcode})
86+
data = f"""{str(replica_status.state)} (exitcode: {exitcode})
8687
timestamp: {datetime.fromtimestamp(timestamp)}
8788
hostname: {replica_status.hostname}
8889
{error_message}"""
8990
else:
90-
data = f"{replica_status.state}"
91+
data = f"{str(replica_status.state)}"
9192
if replica_status.state in [
9293
api.ReplicaState.CANCELLED,
9394
api.ReplicaState.FAILED,

0 commit comments

Comments
 (0)