def scale_down(self, workers, pods=None):
<EOL>pods = pods or self._cleanup_terminated_pods(self.pods())<EOL>ips = set(urlparse(worker).hostname for worker in workers)<EOL>to_delete = [p for p in pods if p.status.pod_ip in ips]<EOL>if not to_delete:<EOL><INDENT>return<EOL><DEDENT>self._delete_pods(to_delete)<EOL>
Remove the pods for the requested list of workers

        When scale_down is called by the _adapt async loop, the workers are
        assumed to have been cleanly closed first and in-memory data has been
        migrated to the remaining workers.

        Note that when the worker process exits, Kubernetes leaves the pods in
        a 'Succeeded' state that we collect here.

        If some workers have not been closed, we just delete the pods with
        matching ip addresses.

        Parameters
        ----------
        workers: List[str] List of addresses of workers to close