Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccmlib/node: capture the output of sstable2json command in logging file #482

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions ccmlib/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,20 +974,19 @@ def clear(self, clear_all=False, only_data=False, saved_caches=False):
self._create_directory()

def run_sstable2json(self, out_file=None, keyspace=None, datafiles=None, column_families=None, enumerate_keys=False):
print("running")
if out_file is None:
out_file = sys.stdout
out_file = subprocess.PIPE
sstable2json = self._find_cmd('sstabledump')
env = self.get_env()
sstablefiles = self.__gather_sstables(datafiles, keyspace, column_families)
print(sstablefiles)
common.print_if_standalone(str(sstablefiles), debug_callback=self.info, end='')
for sstablefile in sstablefiles:
print(f"-- {os.path.basename(sstablefile)} -----")
common.print_if_standalone(f"-- {os.path.basename(sstablefile)} -----", debug_callback=self.info, end='')
args = sstable2json + [sstablefile]
if enumerate_keys:
args = args + ["-e"]
subprocess.call(args, env=env, stdout=out_file)
print("")
res = subprocess.run(args, env=env, stdout=out_file, text=True, check=True)
common.print_if_standalone(res.stdout if res.stdout else '', debug_callback=self.info, end='')

def run_json2sstable(self, in_file, ks, cf, keyspace=None, datafiles=None, column_families=None, enumerate_keys=False):
json2sstable = self._find_cmd('json2sstable')
Expand Down
Loading