code: def run_locking_test(ctx):
      with tempfile.TemporaryDirectory() as dir_name:
          assert get_subprocess_lock_state(ctx, dir_name) == "unlocked"
  
          # create a lock on the test directory
          with lock_ctx(dir_name):
              dir_key = f"{dir_name}-{os.getpid()}"
              assert dir_key in local_mem._locks
              assert local_mem._locks[dir_key]
  
              assert (
                  get_subprocess_lock_state(ctx, dir_name) == "locked"
              )
  
              with lock_ctx(dir_name, timeout=0.1):
                  assert (
                      get_subprocess_lock_state(ctx, dir_name)
                      == "locked"
                  )
  
              assert (
                  get_subprocess_lock_state(ctx, dir_name) == "locked"
              )
  
          assert get_subprocess_lock_state(ctx, dir_name) == "unlocked"
  
file_path: pytensor/tests/compile/test_compilelock.py
imports: import multiprocessing
  import os
  import sys
  import tempfile
  import threading
  import time
  import filelock
  import pytest
  from pytensor.compile.compilelock import force_unlock, local_mem, lock_ctx
label_desc: Use image node_id 4 for calling a global function with example usage: run_locking_test(ctx) without return types