code: def async_manager():
      EnvManager = EnvAsyncManager
      create_cart_pole = partial(gym.make, "CartPole-v1")
      local_env = create_cart_pole()
      EnvManager.register("CartPoleEnv", create_cart_pole)
  
      managers = [EnvManager() for i in range(NUM_ENVS)]
      [manager.start() for manager in managers]
  
      envs = [manager.CartPoleEnv() for manager in managers]
      [env.reset() for env in envs]
  
      for i in range(STEPS):
          actions = [
              local_env.action_space.sample() for _ in range(len(envs))
          ]
          handles = [
              env.step(action) for env, action in zip(envs, actions)
          ]
          results = [handle.get() for handle in handles]
          for j in range(len(results)):
              observation, reward, done, info = results[j]
              if done:
                  envs[j].reset()
          if len(envs) == 0:
              break
  
file_path: fiber/examples/async_manager.py
imports: import gym
  import time
  from functools import partial
  from fiber.managers import AsyncManager, SyncManager
label_desc: Use image node_id 2 for calling a global function with example usage: async_manager() without return types