MCPcopy
hub / github.com/alievk/avatarify-python / send_worker

Method send_worker

afy/predictor_remote.py:128–161  ·  view source on GitHub ↗
(address, send_queue, worker_alive)

Source from the content-addressed store, hash-verified

126
127 @staticmethod
128 def send_worker(address, send_queue, worker_alive):
129 timing = AccumDict()
130 log = Logger('./var/log/send_worker.log', opt.verbose)
131
132 ctx = SerializingContext()
133 sender = ctx.socket(zmq.PUSH)
134 sender.connect(address)
135
136 log(f"Sending to {address}")
137
138 try:
139 while worker_alive.value:
140 tt = TicToc()
141
142 try:
143 msg = send_queue.get(timeout=GET_TIMEOUT)
144 except queue.Empty:
145 continue
146
147 tt.tic()
148 sender.send_data(*msg)
149 timing.add('SEND', tt.toc())
150
151 if opt.verbose:
152 Once(timing, log, per=1)
153 except KeyboardInterrupt:
154 log("send_worker: user interrupt")
155 finally:
156 worker_alive.value = 0
157
158 sender.disconnect(address)
159 sender.close()
160 ctx.destroy()
161 log("send_worker exit")
162
163 @staticmethod
164 def recv_worker(address, recv_queue, worker_alive):

Callers

nothing calls this directly

Calls 10

ticMethod · 0.95
addMethod · 0.95
tocMethod · 0.95
AccumDictClass · 0.90
LoggerClass · 0.90
SerializingContextClass · 0.90
TicTocClass · 0.90
OnceClass · 0.90
logFunction · 0.85
send_dataMethod · 0.80

Tested by

no test coverage detected