'Stop any active threads on a stack.'

def stop(self, stack_id, graceful=False):

    if (stack_id in self.groups):
        self.msg_queues.pop(stack_id, None)
        threadgroup = self.groups.pop(stack_id)
        threads = threadgroup.threads[:]
        threadgroup.stop(graceful)
        threadgroup.wait()
        links_done = dict(((th, False) for th in threads))
        def mark_done(gt, th):
            links_done[th] = True
        for th in threads:
            th.link(mark_done, th)
        while (not all(six.itervalues(links_done))):
            eventlet.sleep()
