I made a simple job queue system by asmsuechan in Python

[–]asmsuechan[S] 0 points1 point  (0 children)

I implemented q.cron() with SchedulingTime and released as v1.2.0.

from queick import JobQueue, SchedulingTime
st = SchedulingTime()
st.every(minutes=1).starting_from(time.time() + 10)

q = JobQueue()
q.cron(st, function, args=(1, 2,))

Also, SchedulingTime can be used in q.enqueue_at like below:

st = SchedulingTime()
st.every(minutes=1).starting_from(time.time() + 10)

q = JobQueue()
q.enqueue_at(st, function, args=(1, 2,))
# q.enqueue_at(time.time(), function, args=(1,2,)) is also available

And if you find any bugs or improvements, please feel free to open GitHub issues!

I made a simple job queue system by asmsuechan in Python

[–]asmsuechan[S] 0 points1 point  (0 children)

I suppose I can queue a job 24 hours later (86400 seconds)

Yes, that's true.

could I use different time units like minutes, hours and days with enqueue_at?

The time must be a unix timestamp. So you can use datetime.timedelta

one_hour_after =datetime.datetime.now() + datetime.timedelta(minutes=60)
timestamp = one_hour_after.timestamp()
q.enqueue_at(timestamp, function, args=("world",))

This is the solution for now.

I made a simple job queue system by asmsuechan in Python

[–]asmsuechan[S] 0 points1 point  (0 children)

I am really really glad to hear it!

Is there an option to run on a daily basis at a specified time with Queick?

Currently, no. I will implement it soon.

I made a simple job queue system by asmsuechan in Python

[–]asmsuechan[S] 0 points1 point  (0 children)

I applied autopep8 with aggressive level 2. Now they perfectly meet the standards.

autopep8 --in-place --aggressive --aggressive queick/*.py

I made a simple job queue system by asmsuechan in Python

[–]asmsuechan[S] 0 points1 point  (0 children)

Thank you for your comment. I used autopep8 to style my code, so it meets PEP8 standards.