Skip to content

Commit 88cb8f1

Browse files
AstroProfundisethercflow
authored andcommitted
pdctl: handle exceptions when PD is not running on the host (#8)
* pdctl: handle exceptions when PD is not running on the host * fix duplicated function call
1 parent d4fb85b commit 88cb8f1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

measurement/tidb/pdctl.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,17 @@ def build_url(uri):
7474
def save_info(self, basedir=None):
7575
full_outputdir = fileutils.build_full_output_dir(
7676
basedir=basedir, subdir=self.pdctl_dir)
77-
fileutils.write_file(os.path.join(
78-
full_outputdir, "%s-health.json" % self.pd_host), self.read_health())
79-
fileutils.write_file(os.path.join(
80-
full_outputdir, "%s-diagnose.json" % self.pd_host), self.read_diagnose())
77+
pd_health = self.read_health()
78+
if pd_health:
79+
fileutils.write_file(os.path.join(
80+
full_outputdir, "%s-health.json" % self.pd_host), pd_health)
81+
pd_diagnose = self.read_diagnose()
82+
if pd_diagnose:
83+
fileutils.write_file(os.path.join(
84+
full_outputdir, "%s-diagnose.json" % self.pd_host), pd_diagnose)
8185

8286
for key, info in self.read_runtime_info().items():
87+
if not info:
88+
continue
8389
fileutils.write_file(os.path.join(
8490
full_outputdir, "%s-%s.json" % (self.pd_host, key)), info)

0 commit comments

Comments
 (0)