code: def _safe_next_runs(state):
      """Uses a system wide lock to get the next runs."""
      try:
          state.run_status_lock.acquire()
      except locklib.Timeout as e:
          log.warning(
              "could not acquire lock for reading staged runs\n"
              "If this error persists, try stopping all queues and "
              "deleting %s",
              e.lock_file,
          )
          return []
      else:
          # Must only be called when we have a lock.
          return _unsafe_next_runs(state)
      finally:
          state.run_status_lock.release()
  
imports: import logging
  import os
  import signal
  import time
  from guild import lock
  from guild import op_util
  from guild import util
  from guild import var
label_desc: Use image node_id 8 for calling a global function with example usage: _safe_next_runs(state) and returns: _unsafe_next_runs, list