Will the setting on actorA also works on actorB created by actorA?

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)

hi @KepingYan, yes, the runtime environment is inheritable, so it will apply to all tasks/actors within a job and all child tasks/actors of a task or actor once set, unless it is overridden.

https://docs.ray.io/en/latest/ray-core/handling-dependencies.html#inheritance

you can verify the behavior with the following code:

import ray
import os


@ray.remote
class B:
  def echo(self):
    return os.environ.get("env_set")


@ray.remote
class A:
  def __init__(self):
    pass

  def create(self):
    return B.remote()


@ray.remote
def foo():
    return B.remote()


a = A.options(runtime_env={"env_vars": {"env_set": "actor"}}).remote()
b = ray.get(a.create.remote())
print(ray.get(b.echo.remote()))

b1 = ray.get(foo.options(runtime_env={"env_vars": {"env_set": "task"}}).remote())
print(ray.get(b1.echo.remote()))

Thanks for your reply~ I got it.