code: def test_invalid_conda_env(
      shutdown_only,
      runtime_env_class,
      set_bad_runtime_env_cache_ttl_seconds,
  ):
      ray.init()
  
      @ray.remote
      def f():
          pass
  
      @ray.remote
      class A:
          def f(self):
              pass
  
      # TODO(somebody): track cache hit/miss statistics.
  
      bad_env = runtime_env_class(
          conda={"dependencies": ["this_doesnt_exist"]}
      )
      with pytest.raises(
          RuntimeEnvSetupError,
          # The actual error message should be included in the exception.
          match="ResolvePackageNotFound",
      ):
          ray.get(f.options(runtime_env=bad_env).remote())
  
      # Check that another valid task can run.
      ray.get(f.remote())
  
      a = A.options(runtime_env=bad_env).remote()
      with pytest.raises(
          ray.exceptions.RuntimeEnvSetupError,
          match="ResolvePackageNotFound",
      ):
          ray.get(a.f.remote())
  
      with pytest.raises(
          RuntimeEnvSetupError, match="ResolvePackageNotFound"
      ):
          ray.get(f.options(runtime_env=bad_env).remote())
  
      # Sleep to wait bad runtime env cache removed.
      time.sleep(bad_runtime_env_cache_ttl_seconds)
  
      with pytest.raises(
          RuntimeEnvSetupError, match="ResolvePackageNotFound"
      ):
          ray.get(f.options(runtime_env=bad_env).remote())
  
file_path: ray/python/ray/tests/test_runtime_env_2.py
imports: import pytest
  import time
  import sys
  import fnmatch
  import os
  from typing import List
  import ray
  from ray.dashboard.modules.job.common import JobStatus
  from ray.exceptions import RuntimeEnvSetupError
  from ray.runtime_env import RuntimeEnv, RuntimeEnvConfig
  from ray._private.test_utils import wait_for_condition
label_desc: Use image node_id 1 for calling a global function with example usage: test_invalid_conda_env(shutdown_only, runtime_env_class, set_bad_runtime_env_cache_ttl_seconds) without return types