def get()

in rlstructures/deprecated/batchers/episodebatchers.py [0:0]


    def get(self, blocking=True):
        if not blocking:
            for w in range(len(self.workers)):
                b = self.workers[w].finished()
                if not b:
                    return None

        max_length = 0
        buffer_slot_id_lists = []
        for w in range(len(self.workers)):
            if self.n_per_worker[w] > 0:
                sid_lists = self.workers[w].get()
                for sids in sid_lists:
                    buffer_slot_id_lists.append(sids)
                    max_length = max(max_length, len(sids))
        if max_length > 1:
            if self.warning == False:
                print(
                    "================== EpisodeBatcher: trajectories over"
                    + " multiple slots => may slow down the acquisition process"
                )
                self.warning = True
            return self.buffer.get_multiple_slots(buffer_slot_id_lists, erase=True)
        else:
            buffer_slot_ids = [i[0] for i in buffer_slot_id_lists]
            return self.buffer.get_single_slots(buffer_slot_ids, erase=True)