code: def test_multi_stdout_err(file):
      if file == "stdout":
          file_handle = "sys.stdout"
      else:  # sys.stderr
          file_handle = "sys.stderr"
  
      script = f"""
  import ray
  import sys
  
  ray.init(num_cpus=1)
  
  @ray.remote
  def foo():
      print(file={file_handle})
  
  @ray.remote
  def bar():
      print(file={file_handle})
  
  @ray.remote
  def baz():
      print(file={file_handle})
  
  ray.get(foo.remote())
  ray.get(bar.remote())
  ray.get(baz.remote())
      """
  
      proc = run_string_as_driver_nonblocking(script)
      if file == "stdout":
          out_str = proc.stdout.read().decode("ascii")
      else:
          out_str = proc.stderr.read().decode("ascii")
  
      out_str = "".join(out_str.splitlines())
      assert "(foo pid=" in out_str, out_str
      assert "(bar pid=" in out_str, out_str
      assert "(baz pid=" in out_str, out_str
  
imports: import os
  import re
  import signal
  import subprocess
  import sys
  import time
  import pytest
  import ray
  from ray._private.test_utils import run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition
label_desc: Use image node_id 19 for calling a global function with example usage: test_multi_stdout_err(file) without return types