code: def task_filter(task_names):
      def _task_filter():
          if task_names == []:
              return lambda _: True
  
          def _filter_fn(task):
              return task.name in task_names
  
          return _filter_fn
  
      return _task_filter
  
file_path: ray/release/nightly_tests/setup_chaos.py
imports: import argparse
  from ray.util.state.api import StateApiClient
  from ray.util.state.common import ListApiOptions, StateResource
  import ray
  from ray._private.test_utils import get_and_run_resource_killer, NodeKillerActor, WorkerKillerActor
label_desc: Use image node_id 2 for calling a global function with example usage: task_filter(task_names) and returns: _task_filter, _filter_fn, function, unknown