Beispiel #1
0
    def _create_simulator_thread(self, idx):
        # spawn a separate thread to run policy
        def populate_job_func():
            exp = self._populate_job_queue.get()
            self._runners[idx].step(exp)

        th = ShareSessionThread(LoopThread(populate_job_func, pausable=False))
        th.name = "SimulatorThread-{}".format(idx)
        return th
Beispiel #2
0
 def get_simulator_thread(self):
     # spawn a separate thread to run policy
     def populate_job_func():
         self._populate_job_queue.get()
         for _ in range(self.update_frequency):
             self._populate_exp()
     th = ShareSessionThread(LoopThread(populate_job_func, pausable=False))
     th.name = "SimulatorThread"
     return th
Beispiel #3
0
 def get_simulator_thread(self):
     # spawn a separate thread to run policy
     def populate_job_func():
         self._populate_job_queue.get()
         for _ in range(self.update_frequency):
             self._populate_exp()
     th = ShareSessionThread(LoopThread(populate_job_func, pausable=False))
     th.name = "SimulatorThread"
     return th
Beispiel #4
0
    def get_simulator_thread(self):
        # spawn a separate thread to run policy
        def populate_job_func():
            self._populate_job_queue.get()
            ###############################################################################
            # HITL UPDATE
            # as self.update_frequency = 0 during pretraining, no workers will be initialized.
            ###############################################################################
            #logger.info("update_frequency: {}".format(self.update_frequency))

            for _ in range(int(self.update_frequency)):
                self._populate_exp()

        th = ShareSessionThread(LoopThread(populate_job_func, pausable=False))
        th.name = "SimulatorThread"
        return th
Beispiel #5
0
    def get_simulator_thread(self):
        # spawn a separate thread to run policy
        def populate_job_func():
            self._populate_job_queue.get()
            i = 0
            # synchronous training
            while i < self.update_frequency:
                if self._populate_exp():
                    i += 1
                    time.sleep(0.1)

            # for _ in range(self.update_frequency):
            #     self._populate_exp()
        th = ShareSessionThread(LoopThread(populate_job_func, pausable=False))
        th.name = "SimulatorThread"
        return th