シミュレーションを実行するために、約 40 のエージェントをインストールしました。しかし、いくつかのスレッドエラーが発生します。エラーを以下に示します。
2019-08-06 10:56:24,120 (socialagent-3.0 16231) エラー: スレッド スレッド 31 での例外: 2019-08-06 10:56:24,124 (socialagent-3.0 16231) エラー: トレースバック (最新の呼び出しが最後) : 2019-08-06 10:56:24,135 (socialagent-3.0 16231) エラー: ファイル "/usr/lib/python2.7/threading.py"、行 801、__bootstrap_inner 内
2019-08-06 10:56:24,162 (socialagent-3.0 16231) エラー:
self.run()2019-08-06 10:56:24,177 (socialagent-3.0 16231) エラー: ファイル "/usr/lib/python2.7/threading.py"、行 1073、実行中
2019-08-06 10:56:24,198 (socialagent-3.0 16231) エラー:
self.function (*self.args、**self.kwargs)2019-08-06 10:56:24,201 (socialagent-3.0 16231) エラー: ファイル "/home/jenny/.volttron/agents/50b42ee5-b6af-4a25-aa89-97e2b1a823e1/socialagent-3.0/social/agent.py" 、145行目、enter_phase3
2019-08-06 10:56:24,240 (socialagent-3.0 16231) エラー:
self.vip.pubsub.publish ('pubsub', ids_topic, message=message)2019-08-06 10:56:24,265 (socialagent-3.0 16231) エラー: ファイル「/home/jenny/workspace/volttron/volttron/platform/vip/agent/subsystems/pubsub.py」、行 607、パブリッシュ
2019-08-06 10:56:24,267 (socialagent-3.0 16231) エラー:
self.vip_socket.send_vip (b''、'pubsub'、frames、result.ident、copy=False)2019-08-06 10:56:24,279 (socialagent-3.0 16231) エラー: ファイル「/home/jenny/workspace/volttron/volttron/platform/vip/socket.py」、行 404、send_vip 内
2019-08-06 10:56:24,326 (socialagent-3.0 16231) エラー:
self._sending(flags) をフラグとして:2019-08-06 10:56:24,327 (socialagent-3.0 16231) エラー: ファイル "/usr/lib/python2.7/contextlib.py"、17 行目、__enter__ 内
2019-08-06 10:56:24,377 (socialagent-3.0 16231) エラー:
self.gen.next() を返します2019-08-06 10:56:24,402 (socialagent-3.0 16231) エラー: ファイル "/home/jenny/workspace/volttron/volttron/platform/vip/green.py"、78 行目、_sending 内
2019-08-06 10:56:24,413 (socialagent-3.0 16231) エラー:
lock.acquire ではありません (フラグ & NOBLOCK ではありません):2019-08-06 10:56:24,422 (socialagent-3.0 16231) エラー: ファイル "/home/jenny/workspace/volttron/env/local/lib/python2.7/site-packages/gevent/lock.py", 210行目、取得中
2019-08-06 10:56:24,427 (socialagent-3.0 16231) エラー: rc = self._block.acquire (ブロッキング)
2019-08-06 10:56:24,442 (socialagent-3.0 16231) エラー: ファイル "gevent/_semaphore.py"、行 198、gevent._semaphore.Semaphore.acquire (gevent/gevent._semaphore.c:4117)
2019-08-06 10:56:24,451 (socialagent-3.0 16231) エラー:
def acquire (self、blocking=True、timeout=None):2019-08-06 10:56:24,485 (socialagent-3.0 16231) エラー: ファイル "gevent/_semaphore.py"、行 226、gevent._semaphore.Semaphore.acquire (gevent/gevent._semaphore.c:3944)
2019-08-06 10:56:24,493 (socialagent-3.0 16231) エラー:
タイムアウト = self._do_wait(タイムアウト)2019-08-06 10:56:24,503 (socialagent-3.0 16231) エラー: ファイル "gevent/_semaphore.py"、行 166、gevent._semaphore.Semaphore._do_wait (gevent/gevent._semaphore.c:3178)
2019-08-06 10:56:24,546 (socialagent-3.0 16231) エラー:
結果 = get_hub().switch()2019-08-06 10:56:24,552 (socialagent-3.0 16231) エラー: ファイル "/home/jenny/workspace/volttron/env/local/lib/python2.7/site-packages/gevent/hub.py", 609 行目、スイッチ内
2019-08-06 10:56:24,574 (socialagent-3.0 16231) エラー:
greenlet.switch(self) を返します2019-08-06 10:56:24,589 (socialagent-3.0 16231) エラー: LoopExit: (「この操作は永久にブロックされます」、)
2019-08-06 10:56:24,640 (socialagent-3.0 16231) エラー:
これは、agent.py ファイルの 145 行目にあるものです:
self.vip.pubsub.publish('pubsub', ds_topic, message=message)
メッセージを message = “something” として既に定義しています</p>
インストールするエージェントの数を減らすと、この問題はまったく発生しなくなります。1.9GHz Intel Core i3 マシンを実行しています。これは関係ありますか?問題の診断に役立つ情報をできるだけ多く提供するために、エージェントの一部を以下に示します。
from threading import Timer
@Core.receiver("onstart")
def starting(self, sender, **kwargs):
_log.debug('Subscribing to all relevant topics')
self.vip.pubsub.subscribe('pubsub', pred_topic, callback=self.from_pred)
def from_pred(self, peer, sender, bus, topic, headers, message):
message_dict = message_parser.mess_conv(message)
message = "{}: {}".format(statID, message_dict['feat_pro'])
# Publish to all neighbour topics and to our own topic
for k in neighbours:
self.vip.pubsub.publish('pubsub', k, message=message)
self.vip.pubsub.publish('pubsub', social_topic, message=message)
# ...and start timer to allow communication for 8s
timer = Timer(8, self.enter_phase)
timer.start()
def enter_phase(self):
# Send a message to IDS to begin phase
_log.debug("In agent {}. We have {}".format(stationID, sent_prob))
if stationID in sent_prob.keys():
message = "phase3: 1"
else:
message = "phase3: 0"
self.vip.pubsub.publish('pubsub', ds_topic, message=message)
また、timer = Timer(8, self.enter_phase)
問題の/一部である可能性はありますか? 私はそのような開発者ではなく、どんな助けにも感謝します(簡単な言葉で:))。