-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreadingVideo.py
More file actions
32 lines (21 loc) · 827 Bytes
/
threadingVideo.py
File metadata and controls
32 lines (21 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import logging
import threading
import time
import sys
# handle and run a few sleep threads
#TODO: will need thread function here
def sleep_thread(name):
logging.info(f"Thread {name}: starting")
time.sleep(3)
logging.info(f"Thread{name}: finished")
if __name__ == "__main__":
logging.basicConfig(format="%(asctime)s: %(message)S", level=logging.INFO,
datefmt="%H:%M:%S")
print(sys.argv)
for i in sys.argv[1:]:
logging.info(f"Main: Thread {i} creation started")
slth = threading.Thread(target=sleep_thread, args=(i,))
logging.info(f"Main: Thread {i} created, preparing to run")
slth.start()
logging.info(f"Main: Thread {i} launched - will notify when complete")
logging.info(f"Rest of program running\n")