def _retry_on_port_collision(reason, add, cleanup):
    # We select a random, available port number on each attempt.  If it was in
    # use it's because the "available" part of that port number selection logic
    # is fairly shaky.  It should be good enough that trying again works fairly
    # well, though.  So do that.
    reason.trap(AddressInUse)
    ip, port = reason.value.address
    used_by = _find_process_name(port)
    ADDRESS_IN_USE(ip=ip, port=port, name=used_by).write()
    d = cleanup()
    d.addCallback(lambda ignored: add())
    return d
Add LOPQ codes into the search index.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/testtools.py/_retry_on_port_collision--crossover with--dataset/ETHPy150Open yahoo/lopq/python/lopq/search.py/LOPQSearcherBase.add_codes