Saturday work. Needed to fix some Anthology enrollments for their internal employees to wrote a new script to remove everyone from their current groups and bulk re-enroll into all the correct groups and courses.
This commit is contained in:
29
Scripts/queue_test.py
Normal file
29
Scripts/queue_test.py
Normal file
@ -0,0 +1,29 @@
|
||||
import threading
|
||||
import queue
|
||||
import time
|
||||
|
||||
q = queue.Queue()
|
||||
|
||||
# def worker():
|
||||
# while True:
|
||||
# item = q.get()
|
||||
# print(f'Working on {item}')
|
||||
# time.sleep(1)
|
||||
# print(f'Finished {item}')
|
||||
# time.sleep(1)
|
||||
# q.task_done()
|
||||
#
|
||||
# # Turn-on the worker thread.
|
||||
# threading.Thread(target=worker, daemon=True).start()
|
||||
#
|
||||
# Send thirty task requests to the worker.
|
||||
for item in range(30):
|
||||
print(f'Working on {item}')
|
||||
time.sleep(1)
|
||||
print(f'Finished {item}')
|
||||
time.sleep(1)
|
||||
# q.put(item)
|
||||
|
||||
# Block until all tasks are done.
|
||||
# q.join()
|
||||
print('All work completed')
|
||||
Reference in New Issue
Block a user