diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 57043b2..e9e79d3 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -9,4 +9,4 @@ RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ make install RUN rm -R ta-lib ta-lib-0.4.0-src.tar.gz -RUN pip install pylivetrader==0.5.0 \ No newline at end of file +RUN pip install pylivetrader==0.5.1 \ No newline at end of file diff --git a/pylivetrader/_version.py b/pylivetrader/_version.py index b2e36af..0885ac0 100644 --- a/pylivetrader/_version.py +++ b/pylivetrader/_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = '0.5.0' +VERSION = '0.5.1' diff --git a/pylivetrader/misc/parallel_utils.py b/pylivetrader/misc/parallel_utils.py index 339f48d..139e2fb 100644 --- a/pylivetrader/misc/parallel_utils.py +++ b/pylivetrader/misc/parallel_utils.py @@ -2,6 +2,8 @@ import os from multiprocessing import Pool +PROCESS_POOL = None + def _get_default_workers(): workers = os.environ.get('PYLT_NUM_WORKERS') @@ -55,8 +57,11 @@ def parallelize_with_multi_process(mapfunc, workers=10): Return: func(args_list) => list[func[arg]] """ + global PROCESS_POOL + if not PROCESS_POOL: + PROCESS_POOL = Pool(workers) + def wrapper(args_list): - with Pool(workers) as pool: - return pool.map(mapfunc, args_list) + return PROCESS_POOL.map(mapfunc, args_list) return wrapper