code: def evaluate_test(
      algo, env="CartPole-v1", test_episode_rollout=False
  ):
      extra_config = ""
      for fw in framework_iterator(frameworks=("tf", "torch")):
          fw_ = ', "framework": "{}"'.format(fw)
  
          tmp_dir = os.popen("mktemp -d").read()[:-1]
          if not os.path.exists(tmp_dir):
              sys.exit(1)
  
          print("Saving results to {}".format(tmp_dir))
  
          print(
              "RLlib dir = {}\nexists={}".format(
                  rllib_dir, os.path.exists(rllib_dir)
              )
          )
          os.system(
              "TEST_TMPDIR='{}' python {}/train.py --local-dir={} --run={} "
              "--checkpoint-freq=1 ".format(
                  tmp_dir, rllib_dir, tmp_dir, algo
              )
              + "--config='{"
              + '"num_workers": 1, "num_gpus": 0{}{}'.format(
                  fw_, extra_config
              )
              + ', "min_sample_timesteps_per_iteration": 5,'
              '"min_time_s_per_iteration": 0.1, '
              '"model": {"fcnet_hiddens": [10]}'
              "}' --stop='{\"training_iteration\": 1}'"
              + " --env={}".format(env)
          )
  
          checkpoint_path = os.popen(
              "ls {}/default/*/checkpoint_000000/algorithm_state.pkl".format(
                  tmp_dir
              )
          ).read()[:-1]
          if not os.path.exists(checkpoint_path):
              sys.exit(1)
          print("Checkpoint path {} (exists)".format(checkpoint_path))
  
          # Test rolling out n steps.
          os.popen(
              'python {}/evaluate.py --run={} "{}" --steps=10 '
              '--out="{}/rollouts_10steps.pkl"'.format(
                  rllib_dir, algo, checkpoint_path, tmp_dir
              )
          ).read()
          if not os.path.exists(tmp_dir + "/rollouts_10steps.pkl"):
              sys.exit(1)
          print("evaluate output (10 steps) exists!")
  
          # Test rolling out 1 episode.
          if test_episode_rollout:
              os.popen(
                  'python {}/evaluate.py --run={} "{}" --episodes=1 '
                  '--out="{}/rollouts_1episode.pkl"'.format(
                      rllib_dir, algo, checkpoint_path, tmp_dir
                  )
              ).read()
              if not os.path.exists(tmp_dir + "/rollouts_1episode.pkl"):
                  sys.exit(1)
              print("evaluate output (1 ep) exists!")
  
          # Cleanup.
          os.popen('rm -rf "{}"'.format(tmp_dir)).read()
  
imports: import os
  from pathlib import Path
  import re
  import sys
  import unittest
  from unittest import mock
  import ray
  from ray import air, tune
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig
  from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
  from ray.rllib.utils.test_utils import framework_iterator
  from ray.tune.registry import get_trainable_cls
  from ray.rllib.core.rl_module.rl_module import SingleAgentRLModuleSpec
  from ray.rllib.core.rl_module.marl_module import MultiAgentRLModuleSpec
label_desc: Use image node_id 1 for calling a global function with example usage: evaluate_test(algo, env, test_episode_rollout) without return types