docstr: Expect some sub-envs to fail (and not recover), but ignore.
docstr_tok: ["Expect","some","sub-envs","to","fail","(","and","not","recover",")",",","but","ignore","."]
code: def test_crash_only_one_worker_during_sampling_but_ignore(self):
      """Expect some sub-envs to fail (and not recover), but ignore."""
      config = (
          PPOConfig()
          .rollouts(
              env_runner_cls=ForwardHealthCheckToEnvWorker,
              num_rollout_workers=2,
              num_envs_per_worker=3,
              # Ignore worker failures (continue with worker #2).
              ignore_worker_failures=True,
          )
          .environment(
              env=CartPoleCrashing,
              env_config={
                  # Crash prob=80%.
                  "p_crash": 0.8,
                  # Only crash on worker with index 1.
                  "crash_on_worker_indices": [1],
                  # Make sure nothing happens during pre-checks.
                  "skip_env_checking": True,
              },
          )
      )
      # Pre-checking disables, so building the Algorithm is save.
      algo = config.build()
      # Expect some errors being logged here, but in general, should continue
      # as we ignore worker failures.
      algo.train()
      # One worker has been removed -> Only one left.
      self.assertEqual(algo.workers.num_healthy_remote_workers(), 1)
      algo.stop()
  
file_path: ray/python/ray/rllib/evaluation/tests/test_envs_that_crash.py
imports: import unittest
  import ray
  from ray.rllib.algorithms.pg import PGConfig
  from ray.rllib.algorithms.ppo import PPOConfig
  from ray.rllib.algorithms.tests.test_worker_failures import ForwardHealthCheckToEnvWorker
  from ray.rllib.examples.env.cartpole_crashing import CartPoleCrashing
  from ray.rllib.utils.error import EnvError
label_desc: Use image node_id 5 for calling the TestEnvsThatCrash obj's underlying member method code with example usage: obj.test_crash_only_one_worker_during_sampling_but_ignore() without return types