Skip to content

Commit

Permalink
Merge 9d7d2ee into 96955b3
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Apr 25, 2019
2 parents 96955b3 + 9d7d2ee commit 9955843
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion epregressions/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import glob
import json
import os
import sys
import random
import subprocess # subprocess allows us to spawn the help pdf separately
import threading # threading allows for the test suite to run multiple E+ runs concurrently
Expand All @@ -26,6 +27,11 @@
from epregressions.builds.visualstudio import CMakeCacheVisualStudioBuildDirectory
from epregressions.builds.install import EPlusInstallDirectory

if sys.version_info.major > 2:
from os import cpu_count
else:
from multiprocessing import cpu_count

# graphics stuff
import gi
gi.require_version('Gdk', '3.0') # unfortunately these have to go before the import
Expand Down Expand Up @@ -602,7 +608,12 @@ def gui_build_notebook_page_test_suite(self):
if platform() != Platforms.Windows:
num_threads_box = Gtk.HBox(homogeneous=False, spacing=box_spacing)
self.suite_option_num_threads = Gtk.SpinButton()
self.suite_option_num_threads.set_range(1, 8)
# Determine max available threads
n_threads_max = cpu_count()
if n_threads_max is None:
# If couldn't be determined, assume 8 as default
n_threads_max = 8 # pragma: no cover -- I cant imagine a way to get cpu_count to fail
self.suite_option_num_threads.set_range(1, n_threads_max)
self.suite_option_num_threads.set_increments(1, 4)
self.suite_option_num_threads.spin(Gtk.SpinType.PAGE_FORWARD, 1)
self.suite_option_num_threads.connect("value-changed", self.suite_option_handler_num_threads)
Expand Down

0 comments on commit 9955843

Please sign in to comment.