code: def test_local_job(tmp_path: Path) -> None:
      def func(p: int) -> int:
          job_env = job_environment.JobEnvironment()
          return p * job_env.local_rank
  
      executor = local.LocalExecutor(tmp_path)
      executor.update_parameters(tasks_per_node=3, nodes=1)
      job1 = executor.submit(func, 1)
  
      executor.update_parameters(tasks_per_node=1)
  
      with executor.batch():
          with pytest.raises(RuntimeError, match="with executor.batch"):
              executor.update_parameters(tasks_per_node=1)
          job2 = executor.submit(func, 2)
      assert job1.results() == [0, 1, 2]
      assert job1.task(1).result() == 1
      assert job1.task(2).result() == 2
      assert job1.task(2).result() == 2
      assert job1.exception() is None
      assert job1.done()
  
      with pytest.raises(ValueError, match="must be between 0 and 2"):
          job1.task(4).result()
  
      assert job2.results() == [0]
      assert job2.task(0).result() == 0
      # single task job is a regular job
      assert job2.task(0) is job2
      assert job2.done()
      # picklability
      b = pickle.dumps(job2)
      job3 = pickle.loads(b)
      assert job3.results() == [0]
      assert job3._process is not None
      del job2
      job3 = pickle.loads(b)
      assert (
          job3._process is None
      ), "garbage collection should I removed finished job"
  
imports: import functools
  import os
  import pickle
  import re
  import signal
  import sys
  import time
  from pathlib import Path
  import pytest
  from submitit import AutoExecutor
  from ..None import helpers
  from ..core import job_environment, test_core, utils
  from .None import local, test_debug
label_desc: Use image node_id 1 for calling a global function with example usage: test_local_job(tmp_path) and returns: unknown