(name)
| 62 | |
| 63 | |
| 64 | def _get_pipe_name(name): |
| 65 | if sys.platform.startswith('linux'): |
| 66 | # linux supports abstract sockets: http://api.zeromq.org/4-1:zmq-ipc |
| 67 | pipename = "ipc://@{}-pipe-{}".format(name, str(uuid.uuid1())[:8]) |
| 68 | pipedir = os.environ.get('TENSORPACK_PIPEDIR', None) |
| 69 | if pipedir is not None: |
| 70 | logger.warn("TENSORPACK_PIPEDIR is not used on Linux any more! Abstract sockets will be used.") |
| 71 | else: |
| 72 | pipedir = os.environ.get('TENSORPACK_PIPEDIR', None) |
| 73 | if pipedir is not None: |
| 74 | logger.info("ZMQ uses TENSORPACK_PIPEDIR={}".format(pipedir)) |
| 75 | else: |
| 76 | pipedir = '.' |
| 77 | assert os.path.isdir(pipedir), pipedir |
| 78 | filename = '{}/{}-pipe-{}'.format(pipedir.rstrip('/'), name, str(uuid.uuid1())[:6]) |
| 79 | assert not os.path.exists(filename), "Pipe {} exists! You may be unlucky.".format(filename) |
| 80 | pipename = "ipc://{}".format(filename) |
| 81 | return pipename |
| 82 | |
| 83 | |
| 84 | def del_weakref(x): |
no test coverage detected