0

我想在高性能计算环境中使用 SCOOP(Python 中的可扩展并发操作)。为了测试 SCOOP,我在我的 Windows 机器上使用 Python 2.7.18 在 Anaconda 环境 (4.10.3) 中安装了该模块。从文档运行此示例脚本时:

# -*- coding: utf-8 -*-

from __future__ import print_function
from scoop import futures

def helloWorld(value):
    return "Hello World from Future #{0}".format(value)

if __name__ == "__main__":
    returnValues = list(futures.map(helloWorld, range(16)))
    print("\n".join(returnValues))

我在控制台中得到以下输出。

(scoop) C:\Users\flyinthelotion\Downloads>python -m scoop -n 6 test_scoop.py
[2021-08-12 09:39:35,285] launcher  INFO    SCOOP 0.7 1.1 on win32 using Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 17:26:54) [MSC v.1500 64 bit (AMD64)], API: 1013
[2021-08-12 09:39:35,285] launcher  INFO    Deploying 6 worker(s) over 1 host(s).
[2021-08-12 09:39:35,286] launcher  INFO    Worker distribution:
[2021-08-12 09:39:35,286] launcher  INFO       127.0.0.1:       5 + origin
Hello World from Future #0
Hello World from Future #1
Hello World from Future #2
Hello World from Future #3
Hello World from Future #4
Hello World from Future #5
Hello World from Future #6
Hello World from Future #7
Hello World from Future #8
Hello World from Future #9
Hello World from Future #10
Hello World from Future #11
Hello World from Future #12
Hello World from Future #13
Hello World from Future #14
Hello World from Future #15
Exception Exception TypeErrorTypeError: : ""''NNoonneeTTyyppee''  oobbjjeecctt  iiss  nnException ooTypeErrortt:   "cc'aaNllollnaaebbTllyeep""e in  in '<< bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000004141C18>>bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003DB2C18>>o ignored
Exception Exception bTypeErrorTypeError ignored
j: : Exception e""TypeErrorc: ''t"NN 'ooiNnnsoee nTTneyyoTpptyee p''ce  a'ool bblojjebaecjbctelt ce it"is  in s i< nsbound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003882C18>>no  ignored
ntoException o tTypeErrortc :  ac"cla'allNlalolbanalbelebTe"ly" in ep in <"e<bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003492C18>> in 'bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000004141F28>> ignored
Exception Exception <  ignored
Exception TypeErrorTypeErrorbound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003DB2F28>>oException TypeError: :  ignored
bTypeError: ""Exception j: "''TypeErrore"'NN: c'NNo"tooon' nnneNieeeTosTTTyn yyypenpppeToee'yte'' p '  oec 'obaoo bjlbbojeljjbecaeejctbccet lttc ie  tis"ii s  in ssi n<  snobound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003882F28>>nn ot ignored
oont Exception tto cTypeError  tca: cc al"aacll'llalaNlllaboaalblnbbaleellbe"Teel" in y""e in <p in  in "<bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003365C18>>e<< in bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003492F28>> ignored
'bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003945C18>>bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000004141F98>>< ignored
Exception   ignored
 ignored
bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003DB2F98>>Exception TypeErroroException  ignored
TypeError: bTypeError: "j: "'e"'Nc'NotNon oneineTseTy Typnyepop'ete ' 'o c boaojblbejljceaetcbc tlti e si"i s in sn < ontnbound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x0000000003882F98>>o o ignored
tct a clcalalallb[lal2021-08-12 09:39:37,559] launcher  (127.0.0.1:51026) INFO    Root process is done.
abebl"l in ee<"[2021-08-12 09:39:37,561] launcher  (127.0.0.1:51026) INFO    Finished cleaning spawned subprocesses.

因此:SCOOP 做了需要做的事情,但同时也会抛出错误。不过,这些错误似乎对其性能没有影响。这对我未来的项目来说是个问题吗?如何避免显示这些错误?

谢谢

4

1 回答 1

0

异常被忽略的消息是因为__del__方法中引发的所有异常都被忽略以保持数据模型的健全。 文档

如果您想便宜地修复它,请尝试捕获错误

于 2021-08-12T07:54:50.507 回答