Skip to content
Snippets Groups Projects
minion.py 405 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 Minion(QueueClient):
    def run(self):
        while True:
            task = self.queue.get()
Guilhem Saurel's avatar
Guilhem Saurel committed
            print('start work on task', task, '...')
            time.sleep(random.randint(5, 15))  # insert hard work here
Guilhem Saurel's avatar
Guilhem Saurel committed
            print('work done for task', task)


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