Hi, I am learning about ray actor and have a confusion. I want to know if I set runtime_env on an actorA, can I get this runtime_env in the actorB created by actorA?
In other words, will the runtime_env I set on actorA will also work on the actorB created by actorA?
I tried to write the code, but I still not sure how to validate it.
import ray
class Worker_Base():
def __init__(self):
pass
def func(self):
worker_runtime_env = None
# can I get the runtime_env here?
# if so, how should I get it?
# worker_runtime_env = to_get(runtime_env)
return worker_runtime_env
class Worker():
def __init__(self):
self.remote_val = ray.remote(num_cpus=1)(Worker_Base)
def func(self):
return self.remote_val.func()
class Executor:
def __init__(self):
self.worker = None
def func(self):
self.worker = Worker()
return self.worker.func()
executor = ray.remote(num_cpus=1)(Executor)
# set runtime_env here
runtime_env = {
"env_vars": {
"OMP_NUM_THREADS": "4"
}
}
executor_actor = executor.options(
runtime_env = runtime_env
).remote()
res = ray.get(executor_actor.func.remote())
print(res)