def terminate(self):
        self.close()

        # Clearing the job queue
        try:
            while 1:
                self._workq.get_nowait()
        except Queue.Empty:
            pass

        # Send one sentinel for each worker thread: each thread will die
        # eventually, leaving the next sentinel for the next thread
        for thr in self._workers:
            self._workq.put(SENTINEL)
Number each item in each group from 0 to the length of that group - 1.
dataset/ETHPy150Open serverdensity/sd-agent/checks/libs/thread_pool.py/Pool.terminate--crossover with--dataset/ETHPy150Open pydata/pandas/pandas/core/groupby.py/GroupBy.cumcount