def _remove_some_work_units(self, work_spec_name, work_unit_names,
                                suffix='', priority_min='-inf',
                                priority_max='+inf'):
        '''Remove some units from somewhere.'''
        now = time.time()
        if work_unit_names is None:
            count = 0
            while True:
                with self.registry.lock(identifier=self.worker_id) as session:
                    names = session.filter(
                        WORK_UNITS_ + work_spec_name + suffix,
                        priority_min=priority_min, priority_max=priority_max,
                        limit=1000)
                    if not names: break
                    count += session.popmany(
                        WORK_UNITS_ + work_spec_name + suffix, *names)
        else:
            # TODO: This needs to honor priority_min/priority_max,
            # otherwise it gets the wrong answer for "available"/
            # "pending" (it will get both states).
            with self.registry.lock(identifier=self.worker_id) as session:
                count = session.popmany(WORK_UNITS_ + work_spec_name + suffix,
                                        *work_unit_names)
        return count
Remove some units from somewhere.