Skip to content

Commit e6017da

Browse files
scottileefacebook-github-bot
authored andcommitted
Fix Pyre failures for collect_env.py (#502)
Summary: Pull Request resolved: #502 Fixes failing Pyre tests in https://github.com/pytorch/torchx/runs/6581929644?check_suite_focus=true. Internally Pyre is run by buck target not by source file while externally it's run by directory. Creating a target for the collect_env.py script should make sure future Pyre issues are caught. Reviewed By: d4l3k Differential Revision: D36670329 fbshipit-source-id: 1453c37f0f4fe5a22a4f57adafd7d8ec734e476b
1 parent f05f2a9 commit e6017da

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

scripts/collect_env.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,32 +108,38 @@ def get_cli_info() -> None:
108108
print(f"kubectl: {get_kubectl_version()}")
109109

110110

111-
def get_aws_version() -> Optional[str]:
111+
def get_aws_version() -> str:
112112
result = run("aws --version")
113113
if result:
114-
return result[1]
114+
return str(result[1])
115+
return "N/A"
115116

116117

117-
def get_gcp_version() -> Optional[str]:
118-
return run("gcloud --version", r"Google Cloud (.*)")
118+
def get_gcp_version() -> str:
119+
result = run("gcloud --version", r"Google Cloud (.*)")
120+
return str(result)
119121

120122

121-
def get_azure_version() -> Optional[str]:
122-
return run("az version", r"\"azure-cli\": (.*)")
123+
def get_azure_version() -> str:
124+
result = run("az version", r"\"azure-cli\": (.*)")
125+
return str(result)
123126

124127

125-
def get_slurm_version() -> Optional[str]:
128+
def get_slurm_version() -> str:
126129
result = run("slurmd --version")
127130
if result:
128-
return result[1]
131+
return str(result[1])
132+
return "N/A"
129133

130134

131-
def get_docker_version() -> Optional[str]:
132-
return run("docker --version", r"Docker version (.*)")
135+
def get_docker_version() -> str:
136+
result = run("docker --version", r"Docker version (.*)")
137+
return str(result)
133138

134139

135-
def get_kubectl_version() -> Optional[str]:
136-
return run("kubectl version --client", r"Client Version: (.*)")
140+
def get_kubectl_version() -> str:
141+
result = run("kubectl version --client", r"Client Version: (.*)")
142+
return str(result)
137143

138144

139145
def main() -> None:

0 commit comments

Comments
 (0)