Skip to content

Commit

Permalink
pdctl: handle exceptions when PD is not running on the host (#8)
Browse files Browse the repository at this point in the history
* pdctl: handle exceptions when PD is not running on the host

* fix duplicated function call
  • Loading branch information
AstroProfundis authored and ethercflow committed May 25, 2018
1 parent d4fb85b commit 88cb8f1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions measurement/tidb/pdctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ def build_url(uri):
def save_info(self, basedir=None):
full_outputdir = fileutils.build_full_output_dir(
basedir=basedir, subdir=self.pdctl_dir)
fileutils.write_file(os.path.join(
full_outputdir, "%s-health.json" % self.pd_host), self.read_health())
fileutils.write_file(os.path.join(
full_outputdir, "%s-diagnose.json" % self.pd_host), self.read_diagnose())
pd_health = self.read_health()
if pd_health:
fileutils.write_file(os.path.join(
full_outputdir, "%s-health.json" % self.pd_host), pd_health)
pd_diagnose = self.read_diagnose()
if pd_diagnose:
fileutils.write_file(os.path.join(
full_outputdir, "%s-diagnose.json" % self.pd_host), pd_diagnose)

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

0 comments on commit 88cb8f1

Please sign in to comment.