Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions adf_core_python/core/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def handle_connect_error(self, msg: Any) -> NoReturn:
msg.reason,
msg.request_id,
)
self.finish_post_connect_event.set()
else:
self.logger.error(
"Failed to connect agent: %s(request_id: %s)",
Expand All @@ -264,10 +265,16 @@ def handle_connect_ok(self, msg: Any) -> None:
self.config.set_value(key, value)
self.send_acknowledge(msg.request_id)
self.post_connect()
self.logger.info(
f"Connected to kernel: {self.__class__.__qualname__} (request_id: {msg.request_id})",
request_id=msg.request_id,
)
if self.precompute_flag:
print("self.precompute_flag: ", self.precompute_flag)
self.precompute()

self.finish_post_connect_event.set()

def handler_sense(self, msg: Any) -> None:
_id = EntityID(msg.agent_id)
time = msg.time
Expand Down
1 change: 0 additions & 1 deletion adf_core_python/core/agent/office/office.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def post_connect(self) -> None:
self.precompute_data,
self._develop_data,
)
self.finish_post_connect_event.set()

def think(self) -> None:
self._tactics_center.think(
Expand Down
2 changes: 0 additions & 2 deletions adf_core_python/core/agent/platoon/platoon.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ def post_connect(self) -> None:
self._develop_data,
)

self.finish_post_connect_event.set()

def think(self) -> None:
action: Action = self._tactics_agent.think(
self._agent_info,
Expand Down
4 changes: 1 addition & 3 deletions adf_core_python/core/launcher/agent_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def connect() -> None:
for thread, event in threads.items():
thread.daemon = True
thread.start()
is_not_timeout = event.wait(5)
if not is_not_timeout:
break
event.wait(5)

connector_thread = threading.Thread(target=connect)
connector_thread_list.append(connector_thread)
Expand Down
3 changes: 0 additions & 3 deletions adf_core_python/core/launcher/connect/component_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def make_connection(self) -> Connection:
return Connection(self.host, self.port)

def connect(self, agent: Agent, _request_id: int) -> None:
self.logger.info(
f"{agent.__class__.__name__} trying to connect to {self.host}:{self.port} request_id: {_request_id}"
)
connection = self.make_connection()
try:
connection.connect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ def connect(
)
threads[thread] = finish_post_connect_event

self.logger.info("Connected ambulance center (count: %d)" % count)
return threads
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ def connect(
)
threads[thread] = finish_post_connect_event

self.logger.info("Connected ambulance team (count: %d)" % count)
return threads
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ def connect(
)
threads[thread] = finish_post_connect_event

self.logger.info("Connected fire brigade (count: %d)" % count)
return threads
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ def connect(
)
threads[thread] = finish_post_connect_event

self.logger.info("Connected fire station (count: %d)" % count)
return threads
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ def connect(
)
threads[thread] = finish_post_connect_event

self.logger.info("Connected police force (count: %d)" % count)
return threads
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ def connect(
)
threads[thread] = finish_post_connect_event

self.logger.info("Connected police office (count: %d)" % count)
return threads
Loading