We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c57ec8 commit 3933de1Copy full SHA for 3933de1
demo.py
@@ -1,12 +1,31 @@
1
import logging
2
import threading
3
+import time
4
5
import pandas as pd
6
7
8
def run(*fs):
9
+ exceptions = []
10
+ threads = []
11
+
12
+ def catch(f):
13
+ try:
14
+ f()
15
+ except Exception as e:
16
+ logging.error(f"Exception occurred: {e}")
17
+ exceptions.append(e)
18
19
for f in fs:
- threading.Thread(target=f).start()
20
+ thread = threading.Thread(target=lambda: catch(f))
21
+ thread.daemon = True # don't wait for this thread to finish
22
+ thread.start()
23
+ threads.append(thread)
24
25
+ while any(thread.is_alive() for thread in threads):
26
+ if exceptions:
27
+ raise exceptions[0]
28
+ time.sleep(1)
29
30
31
def generate_tick_data():
0 commit comments