Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing argument when initializing parallel driver #171

Open
chenzizhao opened this issue Jan 15, 2025 · 0 comments
Open

Missing argument when initializing parallel driver #171

chenzizhao opened this issue Jan 15, 2025 · 0 comments

Comments

@chenzizhao
Copy link

Hi, the initialization of _env_server seems to have an extra "context" object. At least it was not needed in portal/tests
/test_process.py. Did I miss anything? Is it safe to rid the context argument and replace context.running with True?

if parallel:
import multiprocessing as mp
context = mp.get_context()
self.pipes, pipes = zip(*[context.Pipe() for _ in range(self.length)])
fns = [cloudpickle.dumps(fn) for fn in make_env_fns]
self.procs = [
portal.Process(self._env_server, i, pipe, fn, start=True)
for i, (fn, pipe) in enumerate(zip(fns, pipes))]
self.pipes[0].send(('act_space',))

@staticmethod
def _env_server(context, envid, pipe, ctor):
try:
ctor = cloudpickle.loads(ctor)
env = ctor()
while context.running:
if not pipe.poll(0.1):
time.sleep(0.1)
continue
try:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant