def do_send(self, filename):
"""
If a build succeeds and generates files (detailed in a "BUILT"
message), the master will reply with "SEND" *filename* indicating we
should transfer the specified file (this is done on a separate socket
with a different protocol; see :meth:`builder.PiWheelsPackage.transfer`
for more details). Once the transfers concludes, reply to the master
with "SENT".
"""
assert self.slave_id is not None, 'Send before hello'
assert self.builder, 'Send before build / after failed build'
assert self.builder.status, 'Send after failed build'
pkg = [f for f in self.builder.files if f.filename == filename][0]
self.logger.info('Sending %s to master on localhost', pkg.filename)
ctx = zmq.Context.instance()
queue = ctx.socket(zmq.DEALER)
queue.ipv6 = True
queue.hwm = 10
queue.connect('tcp://{master}:5556'.format(master=self.config.master))
try:
pkg.transfer(queue, self.slave_id)
finally:
queue.close()
return ['SENT']
评论列表
文章目录