def stop(self, kill=False):
    if not self.isRunning():
      return

    self.logger.debug('Stopping component %s', self.getName())
    client = getDockerClient()

    # Mark all the containers as draining.
    report('Draining all containers...', component=self)
    for container in self.getAllContainers(client):
      setContainerStatus(container, 'draining')
      self.manager.terminateContainer(container, self)

    # Kill any associated containers if asked.
    if kill:
      for container in self.getAllContainers(client):
        report('Killing container ' + container['Id'][:12], component=self)
        client.kill(container)
        removeContainerMetadata(container)

    # Clear the proxy and rebuild its routes for the running components.
    self.manager.adjustForStoppingComponent(self)
Stops all containers for this component.
dataset/ETHPy150Open DevTable/gantryd/runtime/component.py/Component.stop