code: def test_scatter_gather(batch):
      with tempfile.NamedTemporaryFile("w") as output_file:
          b = batch
  
          for i in range(3):
              j = b.new_job(name=f"foo{i}")
              j.command(f'echo "{i}" > {j.ofile}')
  
          merger = b.new_job()
          merger.command(
              "cat {files} > {ofile}".format(
                  files=" ".join(
                      [j.ofile for j in sorted(b.select_jobs("foo"), key=lambda x: x.name, reverse=True)]  # type: ignore
                  ),
                  ofile=merger.ofile,
              )
          )
  
          b.write_output(merger.ofile, output_file.name)
          b.run()
  
          assert open(output_file.name).read() == "2\n1\n0\n"
  
imports: from typing import AsyncIterator
  import os
  import pytest
  import subprocess
  import tempfile
  from hailtop import pip_version
  from hailtop.batch import Batch, LocalBackend, ResourceGroup
  from hailtop.batch.resource import JobResourceFile
  from hailtop.batch.utils import concatenate
label_desc: Use image node_id 20 for calling a global function with example usage: test_scatter_gather(batch) without return types