def new_job(self, event):
        job = event.job
        t = time.time()
        job.stratum_string()
        flush = job.type == 0
        if flush:
            # Push the old jobs onto the stale list and generate a new
            # blank jobs dict
            self.stale_jobs.append(self.active_jobs)
            self.active_jobs = set()

        self.last_job = job
        self.last_time = t
        self.active_jobs.add(job)

        if job.type in [0, 1]:
            for client in self.clients.itervalues():
                if client.authenticated:
                    client._push(job, flush=flush, block=False)
            self.logger.info(
                "New job enqueued for transmission to {} users in {}"
                .format(len(self.clients), time_format(time.time() - t)))

            if flush:
                self.last_flush_job = job
                self.last_flush_time = time.time()
Gets called whenever there's a new job generated by our jobmanager.
dataset/ETHPy150Open simplecrypto/powerpool/powerpool/stratum_server.py/StratumServer.new_job