Skip to content

Commit b9dcefc

Browse files
author
Cleveland
committed
try/except multiprocessing availablity
1 parent 61db39a commit b9dcefc

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

opppy/dump_utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
from opppy.progress import progress
3434

3535
USE_THREADS = not os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('false', '0', 'f')
36-
if(USE_THREADS):
36+
try:
3737
from multiprocessing import Process, Manager
38+
except:
39+
print("WARNING: multiprocessing module unavailable, turning off threads")
40+
USE_THREADS = False
3841

3942

4043
def point_value_1d(data, x_key, value_key, x_value, method='nearest'):

opppy/output.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
from opppy.progress import *
3434

3535
USE_THREADS = not os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('false', '0', 'f')
36-
if(USE_THREADS):
36+
try:
3737
from multiprocessing import Process, Manager
38+
except:
39+
print("WARNING: multiprocessing module unavailable, turning off threads")
40+
USE_THREADS = False
3841

3942

4043

opppy/tally.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
from opppy.output import *
3434

3535
USE_THREADS = not os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('false', '0', 'f')
36-
if(USE_THREADS):
36+
try:
3737
from multiprocessing import Process, Manager
38-
39-
38+
except:
39+
print("WARNING: multiprocessing module unavailable, turning off threads")
40+
USE_THREADS = False
4041

4142
def append_tally_data(cycle_data, data, sort_key_string):
4243
'''

0 commit comments

Comments
 (0)