Skip to content
Snippets Groups Projects
master.py 410 B
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
#!/usr/bin/env python3
Guilhem Saurel's avatar
Guilhem Saurel committed

import random
import time

from manager import QueueClient


class Master(QueueClient):
    def run(self):
        while True:
            task = random.randint(5, 1e3)
            print('new task:', task)
            self.queue.put(task)
Guilhem Saurel's avatar
Guilhem Saurel committed
            print('tasks left:', self.queue.qsize())
Guilhem Saurel's avatar
Guilhem Saurel committed
            time.sleep(random.randint(1, 10))


if __name__ == '__main__':
    Master().run()