def _wait(jid):
    if jid is None:
        jid = salt.utils.jid.gen_jid()
    states = _prior_running_states(jid)
    while states:
        time.sleep(1)
        states = _prior_running_states(jid)
Wait for all previously started state jobs to finish running
dataset/ETHPy150Open saltstack/salt/salt/modules/state.py/_wait