MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _get_pipe_name

Function _get_pipe_name

tensorpack/dataflow/parallel.py:64–81  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

62
63
64def _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
84def del_weakref(x):

Callers 3

reset_stateMethod · 0.85
reset_stateMethod · 0.85
reset_stateMethod · 0.85

Calls 2

formatMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected