code: def test_update_envs_env_update():
      max_episode_length = 16
      env = PointEnv()
      policy = FixedPolicy(
          env.spec,
          scripted_actions=[
              env.action_space.sample()
              for _ in range(max_episode_length)
          ],
      )
      tasks = SetTaskSampler(PointEnv)
      n_workers = 8
      workers = WorkerFactory(
          seed=100,
          max_episode_length=max_episode_length,
          n_workers=n_workers,
      )
      sampler = LocalSampler.from_worker_factory(workers, policy, env)
      episodes = sampler.obtain_samples(
          0,
          161,
          np.asarray(policy.get_param_values()),
          env_update=tasks.sample(n_workers),
      )
      mean_rewards = []
      goals = []
      for eps in episodes.split():
          mean_rewards.append(eps.rewards.mean())
          goals.append(eps.env_infos["task"][0]["goal"])
      assert len(mean_rewards) == 11
      assert len(goals) == 11
      assert np.var(mean_rewards) > 1e-2
      assert np.var(goals) > 1e-2
      with pytest.raises(ValueError):
          sampler.obtain_samples(
              0,
              10,
              np.asarray(policy.get_param_values()),
              env_update=tasks.sample(n_workers + 1),
          )
  
file_path: garage/tests/garage/sampler/test_local_sampler.py
imports: import numpy
  import pytest
  from garage.envs import PointEnv
  from garage.experiment.task_sampler import SetTaskSampler
  from garage.np.policies import FixedPolicy
  from garage.sampler import LocalSampler, WorkerFactory
label_desc: Use image node_id 1 for calling a global function with example usage: test_update_envs_env_update() without return types