Skip to content
Browse files

fixed GermanTaskHandler max_workers default raises TypeError. (NonTyp…

…e cannot be converted to int)
  • Loading branch information...
1 parent 7fe030c commit 11acdabb4fa67fe3a5488e1698d48ee2876e77c0 @titusz titusz committed Feb 11, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 gmtasks/__init__.py
View
17 gmtasks/__init__.py
@@ -91,7 +91,15 @@ def __init__(self,
):
self.host_list = host_list
self.tasks = tasks
- self.max_workers = int(max_workers)
+
+ if max_workers:
+ self.max_workers = int(max_workers)
+ else:
+ try:
+ self.max_workers = int(cpu_count())
+ except:
+ self.max_workers = 1
+
self.worker = worker_class
self.id_prefix = id_prefix
self.verbose = verbose
@@ -100,12 +108,7 @@ def __init__(self,
# Signal Handler override?
if use_sighandler:
self._setup_sighandler()
- # Sanity check
- if self.max_workers < 1:
- try:
- self.max_workers = int(cpu_count())
- except:
- self.max_workers = 1
+
def serve_forever(self):
"""

0 comments on commit 11acdab

Please sign in to comment.
Something went wrong with that request. Please try again.