def do_send(builder, filename):
"""
Handles sending files when requested by :func:`do_import`.
"""
logging.info('Sending %s to master', filename)
pkg = [f for f in builder.files if f.filename == filename][0]
ctx = zmq.Context.instance()
queue = ctx.socket(zmq.DEALER)
queue.ipv6 = True
queue.hwm = 10
# NOTE: The following assumes that we're running on the master; this
# *should* be the case (it's risky to run the importer on a tcp queue)
# but there's no guarantee of this.
queue.connect('tcp://localhost:5556')
try:
pkg.transfer(queue, 0)
finally:
queue.close()
评论列表
文章目录