code: def test_pickle():
      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 = 4
      workers = WorkerFactory(
          seed=100,
          max_episode_length=max_episode_length,
          n_workers=n_workers,
      )
      sampler = MultiprocessingSampler.from_worker_factory(
          workers, policy, env
      )
      sampler_pickled = pickle.dumps(sampler)
      sampler.shutdown_worker()
      sampler2 = pickle.loads(sampler_pickled)
      episodes = sampler2.obtain_samples(
          0,
          500,
          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 np.var(mean_rewards) > 0
      assert np.var(goals) > 0
      sampler2.shutdown_worker()
      env.close()
  
file_path: garage/tests/garage/sampler/test_multiprocessing_sampler.py
imports: import pickle
  from unittest.mock import Mock
  import numpy
  import pytest
  from garage.envs import PointEnv
  from garage.envs.grid_world_env import GridWorldEnv
  from garage.experiment.task_sampler import SetTaskSampler
  from garage.np.policies import FixedPolicy, ScriptedPolicy
  from garage.sampler import LocalSampler, MultiprocessingSampler, WorkerFactory
label_desc: Use image node_id 6 for calling a global function with example usage: test_pickle() without return types