import re


def parse_shutdown_result(result):
  """Parse the shutdown result string and return the strings (grace left,
  deadline left, queries registered, queries executing)."""
  assert len(result.data) == 1
  summary = result.data[0]
  match = re.match(r'startup grace period left: ([0-9ms]*), deadline left: ([0-9ms]*), ' +
      r'queries registered on coordinator: ([0-9]*), queries executing: ([0-9]*), ' +
      r'fragment instances: [0-9]*', summary)
  assert match is not None, summary
  return match.groups()