fix diagnostic tool return value

This commit is contained in:
Jake Freck 2018-08-07 15:03:58 -07:00
Родитель a3a220e44d
Коммит 9e4f41af94
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -13,17 +13,18 @@ def _run(spark_cluster_operations, cluster_id, output_directory=None):
ssh_cmd = _build_diagnostic_ssh_command()
run_output = spark_cluster_operations.run(cluster_id, ssh_cmd, host=True)
remote_path = "/tmp/debug.zip"
result = None
if output_directory:
local_path = os.path.join(os.path.abspath(output_directory), "debug.zip")
output = spark_cluster_operations.download(cluster_id, remote_path, local_path, host=True)
result = spark_cluster_operations.download(cluster_id, remote_path, local_path, host=True)
# write run output to debug/ directory
with open(os.path.join(os.path.dirname(local_path), "debug-output.txt"), 'w', encoding="UTF-8") as f:
[f.write(line + '\n') for node_output in run_output for line in node_output.output]
else:
output = spark_cluster_operations.download(cluster_id, remote_path, host=True)
result = spark_cluster_operations.download(cluster_id, remote_path, host=True)
return output
return result
def _build_diagnostic_ssh_command():