code: def test_init_with_env_updates(policy, envs):
      task_sampler = EnvPoolSampler(envs)
      envs = task_sampler.sample(N_EPS)
      true_workers = WorkerFactory(
          seed=100,
          n_workers=N_EPS,
          max_episode_length=MAX_EPISODE_LENGTH,
      )
      true_sampler = LocalSampler.from_worker_factory(
          true_workers, policy, envs
      )
      vec_workers = WorkerFactory(
          seed=100,
          n_workers=1,
          worker_class=VecWorker,
          worker_args=dict(n_envs=N_EPS),
          max_episode_length=MAX_EPISODE_LENGTH,
      )
      vec_sampler = LocalSampler.from_worker_factory(
          vec_workers, [policy], [envs]
      )
      n_samples = 100
      true_eps = true_sampler.obtain_samples(0, n_samples, None)
      vec_eps = vec_sampler.obtain_samples(0, n_samples, None)
  
      assert vec_eps.lengths.sum() >= n_samples
      assert_eps_eq(true_eps, vec_eps)
  
      true_sampler.shutdown_worker()
      vec_sampler.shutdown_worker()
  
file_path: garage/tests/garage/sampler/test_vec_worker.py
imports: import pprint
  import pytest
  from garage.envs import GridWorldEnv
  from garage.experiment.task_sampler import EnvPoolSampler
  from garage.np.policies import ScriptedPolicy
  from garage.sampler import LocalSampler, VecWorker, WorkerFactory
label_desc: Use image node_id 10 for calling a global function with example usage: test_init_with_env_updates(policy, envs) without return types