Skip to content

cannot limit the workers #2

@jmriego

Description

@jmriego

Hi! sorry if I'm misunderstanding this completely but I'm trying to create a way to queue jobs in my Raspberry Pi and only have them running sequentially. My test code is like this:

# test.py
from queick import JobQueue
from jobfunc import function
from time import time

q = JobQueue()
for i in range(1,50):
    q.enqueue(function, args=(f"hello{i}",), priority=i, max_workers=1)
# jobfunc.py
def function(arg):
    time.sleep(5)
    print(arg)

I was expecting this code would show me one hello{i} every 5 seconds as I'm only passing max_workers as 1 and all jobs have a different priority. Instead, after 5 seconds all jobs finish at the same time.
Any idea of what am I doing wrong? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions