Skip to content
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

Merged
merged 6 commits into from
Sep 15, 2017
Merged

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Sep 15, 2017

Follow up to comments on #182 that didn't get addressed before r2b3

  • Simplified custom_executor example

  • Shortened test paths

  • Linux Build Status

  • Linux-aarch64 Build Status

  • macOS Build Status

  • Windows Build Status

@sloretz sloretz added the in progress Actively being worked on (Kanban column) label Sep 15, 2017
@@ -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)
Copy link
Member

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()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sloretz sloretz added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Sep 15, 2017
@@ -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())
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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.

Copy link
Contributor Author

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))
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sloretz
Copy link
Contributor Author

sloretz commented Sep 15, 2017

Builds passed and approved, squash/merging

@sloretz sloretz merged commit 052aa56 into master Sep 15, 2017
@sloretz sloretz removed the in review Waiting for review (Kanban column) label Sep 15, 2017
@sloretz sloretz deleted the custom_executor_worker_thread branch September 15, 2017 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants