python应用程序在本地工作,但在docker中给出错误

时间:2018-11-30 11:19:48

标签: python docker flask scikit-learn

我在本地主机上运行我的应用程序:80,并且得到了正确的结果。 然后我构建一个docker映像并运行它,它给出以下错误(在附加模式下运行docker):

我正在使用Windows 10。

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./main.py", line 90, in scan
    result = sig_analyzer(signature=text)
  File "./sig_analyze.py", line 65, in sig_analyzer
    line_classes, probsA = classify.line_predict(signature)
  File "./classify.py", line 31, in line_predict
    classes = mlp.predict(feats)
  File "/usr/local/lib/python3.6/site-packages/sklearn/ensemble/bagging.py", line 643, in predict
    predicted_probabilitiy = self.predict_proba(X)
  File "/usr/local/lib/python3.6/site-packages/sklearn/ensemble/bagging.py", line 692, in predict_proba
    for i in range(n_jobs))
  File "/usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py", line 996, in __call__
    self.retrieve()
  File "/usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py", line 899, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 517, in wrap_future_result
    return future.result(timeout=timeout)
  File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
sklearn.externals.joblib.externals.loky.process_executor.TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker.

为什么它在本地运行但不能在容器中运行?为什么我的操作系统会杀死这样的进程?

我应该澄清一下,同一应用程序的早期版本运行良好。区别在于,现在我正在使用一个在多个线程中执行的函数(来自sklearn的装袋分类器)。线程数不是问题(例如,我只运行2个线程,并使用尽可能多的线程)。

docker是否需要特定的配置才能运行多个线程?

0 个答案:

没有答案