intive-DataScience / tbats

BATS and TBATS forecasting methods
MIT License
178 stars 19 forks source link

Random errors in threading <class 'KeyboardInterrupt'> #20

Open jonatasfreitasv opened 4 years ago

jonatasfreitasv commented 4 years ago

I try a lot of combination of memory and cpu, 1, 4, 6, 8, etc... This error is random, if run again, complete with success.

Enviroment: Docker with image continuumio/miniconda3:4.8.2-alpine

Stack strace: [<FrameSummary file main.py, line 56 in <module>>, <FrameSummary file /app/forecast.py, line 30 in make_prediction>, <FrameSummary file /app/tbatsmodel.py, line 97 in tbats_forecast>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/site-packages/tbats/abstract/Estimator.py, line 98 in fit>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/site-packages/tbats/tbats/TBATS.py, line 76 in _do_fit>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/site-packages/tbats/abstract/Estimator.py, line 144 in _choose_model_from_possible_component_settings>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/multiprocessing/pool.py, line 268 in map>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/multiprocessing/pool.py, line 651 in get>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/multiprocessing/pool.py, line 648 in wait>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/threading.py, line 552 in wait>, <FrameSummary file /opt/conda/envs/env/lib/python3.7/threading.py, line 296 in wait>]

Conda env:

name: env
channels:
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - asn1crypto=0.24.0=py37_1003
  - binutils_impl_linux-64=2.31.1=h6176602_1
  - binutils_linux-64=2.31.1=h6176602_8
  - bitarray=1.0.1=py37h516909a_0
  - bzip2=1.0.8=h516909a_0
  - ca-certificates=2019.6.16=hecc5488_0
  - certifi=2019.6.16=py37_1
  - cffi=1.12.3=py37h8022711_0
  - chardet=3.0.4=py37_1003
  - click=7.0=py_0
  - cryptography=2.7=py37h72c5cf5_0
  - cycler=0.10.0=py_1
  - cython=0.29.13=py37he1b5a44_0
  - dbus=1.13.6=he372182_0
  - expat=2.2.5=he1b5a44_1003
  - fontconfig=2.13.1=h86ecdb6_1001
  - freetype=2.10.0=he983fc9_1
  - gcc_impl_linux-64=7.3.0=habb00fd_1
  - gcc_linux-64=7.3.0=h553295d_8
  - gettext=0.19.8.1=hc5be6a0_1002
  - glib=2.58.3=h6f030ca_1002
  - gst-plugins-base=1.14.5=h0935bb2_0
  - gstreamer=1.14.5=h36ae1b5_0
  - gxx_impl_linux-64=7.3.0=hdf63c60_1
  - gxx_linux-64=7.3.0=h553295d_8
  - icu=64.2=he1b5a44_0
  - idna=2.8=py37_1000
  - tqdm=4.41.0
  - joblib=0.13.2=py_0
  - jpeg=9c=h14c3975_1001
  - python-confluent-kafka=1.3.0
  - kiwisolver=1.1.0=py37hc9558a2_0
  - libblas=3.8.0=12_openblas
  - libcblas=3.8.0=12_openblas
  - libffi=3.2.1=he1b5a44_1006
  - libgcc-ng=9.1.0=hdf63c60_0
  - libgfortran-ng=7.3.0=hdf63c60_0
  - libiconv=1.15=h516909a_1005
  - liblapack=3.8.0=12_openblas
  - libopenblas=0.3.7=h6e990d7_1
  - libpng=1.6.37=hed695b0_0
  - libstdcxx-ng=9.1.0=hdf63c60_0
  - libuuid=2.32.1=h14c3975_1000
  - libxcb=1.13=h14c3975_1002
  - libxml2=2.9.9=hee79883_2
  - matplotlib=3.1.1=py37_1
  - matplotlib-base=3.1.1=py37he7580a8_1
  - ncurses=6.1=hf484d3e_1002
  - numpy=1.16.4=py37h95a1406_0
  - openssl=1.1.1c=h516909a_0
  - pandas=0.24.2=py37hb3f55d8_0
  - patsy=0.5.1=py_0
  - pcre=8.41=hf484d3e_1003
  - pip=19.2.2=py37_0
  - ply=3.11=py_1
  - pthread-stubs=0.4=h14c3975_1001
  - pycparser=2.19=py37_1
  - pyopenssl=19.0.0=py37_0
  - pyparsing=2.2.0=py_1
  - pyqt=5.9.2=py37hcca6a23_2
  - pysocks=1.7.0=py37_0
  - pystan=2.18.0.0=py37h962f231_0
  - python=3.7.3=h33d41f4_1
  - python-dateutil=2.8.0=py_0
  - python-dotenv=0.10.1=py_0
  - pytz=2019.2=py_0
  - qt=5.9.7=h0c104cb_3
  - readline=8.0=hf8c457e_0
  - requests=2.22.0=py37_1
  - scikit-learn=0.21.2=py37hcdab131_1
  - scipy=1.3.1=py37h921218d_2
  - setuptools=41.2.0=py37_0
  - sip=4.19.8=py37hf484d3e_1000
  - six=1.12.0=py37_1000
  - sqlite=3.29.0=hcee41ef_0
  - statsmodels=0.10.1=py37hc1659b7_0
  - thriftpy2=0.4.11
  - thrift=0.13.0
  - impyla=0.16.2
  - tk=8.6.9=hed695b0_1002
  - tornado=6.0.3=py37h516909a_0
  - urllib3=1.25.3=py37_0
  - wheel=0.33.6=py37_0
  - xorg-libxau=1.0.9=h14c3975_0
  - xorg-libxdmcp=1.1.3=h516909a_0
  - xz=5.2.4=h14c3975_1001
  - zlib=1.2.11=h516909a_1005

  - pip:
    - tbats
cotterpl commented 4 years ago

Can you explain a bit more? What kind of random errors do you see? The keyboard interrupt in the title of your message suggest somebody simply stopped the process. Have you tried using n_jobs=1 does the error also happen in that case?

cotterpl commented 4 years ago

I have changed the method in which threads are being spawn. Please upgrade to latest version and let me know if the issue is still present.

jonatasfreitasv commented 4 years ago

Not solve.

Why not use more high level threading implementation like ProcessPoolExecutor from native Python concurrent.futures package?