Skip to content

Commit

Permalink
Fix default value of max_workers
Browse files Browse the repository at this point in the history
  • Loading branch information
laughingman7743 committed Sep 18, 2017
1 parent 4f1d08c commit 2209043
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pyathena/async_cursor.py
Expand Up @@ -2,7 +2,6 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os

from concurrent.futures.thread import ThreadPoolExecutor

Expand All @@ -11,6 +10,12 @@
from pyathena.error import ProgrammingError, NotSupportedError
from pyathena.result_set import AthenaResultSet

try:
from multiprocessing import cpu_count
except ImportError:
def cpu_count():
return None


_logger = logging.getLogger(__name__)

Expand All @@ -21,7 +26,7 @@ def __init__(self, client, s3_staging_dir, schema_name, poll_interval,
encryption_option, kms_key, converter, formatter,
retry_exceptions, retry_attempt, retry_multiplier,
retry_max_delay, retry_exponential_base,
max_workers=(os.cpu_count() or 1) * 5,
max_workers=(cpu_count() or 1) * 5,
arraysize=CursorIterator.DEFAULT_FETCH_SIZE):
super(AsyncCursor, self).__init__(client, s3_staging_dir, schema_name, poll_interval,
encryption_option, kms_key, converter, formatter,
Expand Down

0 comments on commit 2209043

Please sign in to comment.