code: def test_lock_file(working_dir):
      # Start a bunch of process competing for lock
      lock_path = os.path.join(working_dir, "lock")
      threads = []
      for _ in range(3):
          t = _start_wait_process(lock_path, 2)
          threads.append(t)
  
      # For each process, collect the timestamp when it acquired and released
      # the lock, as well at the number of wait loops.
      ranges = []
      while threads:
          t = threads.pop()
          res = t()
          assert res is not None
          lines = res.splitlines()
          assert len(lines) == 2
          start = lines[0]
          end = lines[1]
          ranges.append((float(start), float(end)))
      ranges.sort()
  
      # Check the range are exclusive: the lock works assuming it got hit
      for i in range(len(ranges) - 1):
          end = ranges[i][1]
          start = ranges[i + 1][0]
          assert end <= start
  
file_path: modelkit/tests/assets/test_lock.py
imports: import os
  import subprocess
  import sys
  import threading
  import traceback
  from modelkit.assets.remote import StorageProvider
  from tests import TEST_DIR
label_desc: Use image node_id 2 for calling a global function with example usage: test_lock_file(working_dir) without return types