-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Follow up to executor example comments #184
Conversation
@@ -45,16 +45,14 @@ class PriorityExecutor(Executor): | |||
def __init__(self): | |||
super().__init__() | |||
self.high_priority_nodes = set() | |||
self.low_priority_thread = None | |||
self.hp_executor = ThreadPoolExecutor(max_workers=10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is only an example... but 10
seems a little high. Maybe cpu_count()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -45,16 +46,14 @@ class PriorityExecutor(Executor): | |||
def __init__(self): | |||
super().__init__() | |||
self.high_priority_nodes = set() | |||
self.low_priority_thread = None | |||
self.hp_executor = ThreadPoolExecutor(max_workers=multiprocessing.cpu_count()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpu_count()
may raise NotImplementedError
which you need to catch and fall back to a hard coded value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about omitting max_workers? In python 3.5 it will use os.cpu_count() * 5 if it's implemented, or 5 workers if it's not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like high defaults when not doing IO-intense operations. Since this example doesn't "do" much it probable doesn't matter. Not sure if it sets a good example - maybe with a comment to document what the default is that is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpu_count() or 4 workers in 5faf216
@@ -46,7 +46,7 @@ class PriorityExecutor(Executor): | |||
def __init__(self): | |||
super().__init__() | |||
self.high_priority_nodes = set() | |||
self.hp_executor = ThreadPoolExecutor(max_workers=multiprocessing.cpu_count()) | |||
self.hp_executor = ThreadPoolExecutor(max_workers=(os.cpu_count() or 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove the unnecessary parenthesis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds passed and approved, squash/merging |
Follow up to comments on #182 that didn't get addressed before r2b3
Simplified custom_executor example
Shortened test paths
Linux![Build Status](https://camo.githubusercontent.com/6077716adefcd98637cf75e0136ea5a3cf65e11d2bd8cec5e62f6d9fe3a32611/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f6c696e7578266275696c643d33323535)
Linux-aarch64![Build Status](https://camo.githubusercontent.com/9bd892a82af4ec9d88cdcb80de49de50fcb74d1403a48dabc191f17a00d5d331/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f6c696e75782d61617263683634266275696c643d353436)
macOS![Build Status](https://camo.githubusercontent.com/3915087f47bc0e7f1c810a3c6a6d5ca11a52e426e20be9968bbee5aae647c5df/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f6f7378266275696c643d32353834)
Windows![Build Status](https://camo.githubusercontent.com/9d98ca9d648cd7090b04c59bc66c50e35f921f8f1b21e5ac4d8d968443c757c7/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f77696e646f7773266275696c643d33333034)