def Cleanup(benchmark_spec):
  """Stop and remove docker containers. Remove images.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
  master = benchmark_spec.vm_groups['master'][0]
  workers = benchmark_spec.vm_groups['workers']

  def CleanupCommon(vm):
    vm.RemoteCommand('sudo docker rm -v data')
    vm.RemoteCommand('sudo docker rmi cloudsuite/movielens-dataset')
    vm.RemoteCommand('sudo docker rmi cloudsuite/spark')

  def CleanupMaster(vm):
    vm.RemoteCommand('sudo docker stop spark-master')
    vm.RemoteCommand('sudo docker rm spark-master')
    vm.RemoteCommand('sudo docker rmi cloudsuite/in-memory-analytics')
    CleanupCommon(vm)

  def CleanupWorker(vm):
    vm.RemoteCommand('sudo docker stop spark-worker')
    vm.RemoteCommand('sudo docker rm spark-worker')
    CleanupCommon(vm)

  target_arg_tuples = ([(CleanupWorker, [vm], {}) for vm in workers] *
                       [(CleanupMaster, [master], {})])
  vm_util.RunParallelThreads(target_arg_tuples, len(target_arg_tuples))
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_benchmarks/cloudsuite_in_memory_analytics_benchmark.py/Cleanup/operator `+` -> `*`