def _send_job_reply(self, job_info, resending=False, coro=None):
        """Internal use only.
        """
        job_reply = job_info.job_reply
        _dispy_logger.debug('Sending result for job %s (%s) to %s',
                            job_reply.uid, job_reply.status, str(job_info.reply_addr))
        compute = self.computations.get(job_info.compute_id, None)
        if not resending:
            self.thread_lock.acquire()
            assert self.job_infos.pop(job_reply.uid, None) is not None
            self.thread_lock.release()
            self.avail_cpus += 1
            assert self.avail_cpus <= self.num_cpus
            if compute:
                compute.pending_jobs -= 1

        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock = AsyncSocket(sock, keyfile=self.keyfile, certfile=self.certfile)
        sock.settimeout(MsgTimeout)
        try:
            yield sock.connect(job_info.reply_addr)
            yield sock.send_msg('JOB_REPLY:' + serialize(job_reply))
            ack = yield sock.recv_msg()
            assert ack == 'ACK'
        except:
            status = -1
            if not resending:
                # store job result so it can be sent when client is
                # reachable or recovered by user
                f = os.path.join(job_info.compute_dest_path, '_dispy_job_reply_%s' % job_reply.uid)
                _dispy_logger.error('Could not send reply for job %s to %s; saving it in "%s"',
                                    job_reply.uid, str(job_info.reply_addr), f)
                try:
                    fd = open(f, 'wb')
                    pickle.dump(job_reply, fd)
                    fd.close()
                except:
                    _dispy_logger.debug('Could not save reply for job %s', job_reply.uid)
                else:
                    if compute is not None:
                        compute.pending_results += 1
        else:
            status = 0

            if compute:
                compute.last_pulse = time.time()
                if resending:
                    compute.pending_results -= 1
                elif compute.pending_results:
                    Coro(self.resend_job_results, compute)

            if resending:
                f = os.path.join(job_info.compute_dest_path,
                                 job_reply.uid % '_dispy_job_reply_%s')
                if os.path.isfile(f):
                    try:
                        os.remove(f)
                    except:
                        _dispy_logger.warning('Could not remove "%s"', f)
                if compute is None:
                    fd = open(os.path.join(self.dest_path_prefix,
                                           '%s_%s' % (job_info.compute_id, job_info.compute_auth)),
                              'rb')
                    compute = pickle.load(fd)
                    fd.close()
                    if compute:
                        compute.pending_results -= 1

        finally:
            sock.close()

        if compute and compute.pending_jobs == 0 and compute.zombie:
            self.cleanup_computation(compute)
        raise StopIteration(status)
dataset/ETHPy150Open pgiri/dispy/py2/dispy/dispynode.py/_DispyNode._send_job_reply/swapped operands of `%`