Add no_update_feedback option.

This commit is contained in:
Xuwznln
2026-01-09 17:18:39 +08:00
parent 657f952e7a
commit aacf3497e0
7 changed files with 62 additions and 1000 deletions

View File

@@ -24,7 +24,7 @@ extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon", # 如果您使用 Google 或 NumPy 风格的 docstrings
"sphinx_rtd_theme",
"sphinxcontrib.mermaid"
"sphinxcontrib.mermaid",
]
source_suffix = {
@@ -58,7 +58,7 @@ html_theme = "sphinx_rtd_theme"
# sphinx-book-theme 主题选项
html_theme_options = {
"repository_url": "https://github.com/用户名/Uni-Lab",
"repository_url": "https://github.com/deepmodeling/Uni-Lab-OS",
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": True,

File diff suppressed because it is too large Load Diff

View File

@@ -12,3 +12,7 @@ sphinx-copybutton>=0.5.0
# 用于自动摘要生成
sphinx-autobuild>=2024.2.4
# 用于PDF导出 (rinohtype方案纯Python无需LaTeX)
rinohtype>=0.5.4
sphinx-simplepdf>=1.6.0

View File

@@ -156,6 +156,11 @@ def parse_args():
default=False,
help="Complete registry information",
)
parser.add_argument(
"--no_update_feedback",
action="store_true",
help="Disable sending update feedback to server",
)
# workflow upload subcommand
workflow_parser = subparsers.add_parser(
"workflow_upload",
@@ -297,6 +302,7 @@ def main():
BasicConfig.is_host_mode = not args_dict.get("is_slave", False)
BasicConfig.slave_no_host = args_dict.get("slave_no_host", False)
BasicConfig.upload_registry = args_dict.get("upload_registry", False)
BasicConfig.no_update_feedback = args_dict.get("no_update_feedback", False)
BasicConfig.communication_protocol = "websocket"
machine_name = os.popen("hostname").read().strip()
machine_name = "".join([c if c.isalnum() or c == "_" else "_" for c in machine_name])

View File

@@ -488,7 +488,11 @@ class MessageProcessor:
async for message in self.websocket:
try:
data = json.loads(message)
await self._process_message(data)
if self.session_id and self.session_id == data.get("edge_session"):
await self._process_message(data)
else:
logger.trace(f"[MessageProcessor] 收到一条归属 {data.get('edge_session')} 的旧消息:{data}")
logger.debug(f"[MessageProcessor] 跳过了一条归属 {data.get('edge_session')} 的旧消息: {data.get('action')}")
except json.JSONDecodeError:
logger.error(f"[MessageProcessor] Invalid JSON received: {message}")
except Exception as e:

View File

@@ -16,6 +16,7 @@ class BasicConfig:
upload_registry = False
machine_name = "undefined"
vis_2d_enable = False
no_update_feedback = False
enable_resource_load = True
communication_protocol = "websocket"
startup_json_path = None # 填写绝对路径

View File

@@ -20,6 +20,8 @@ from rclpy.callback_groups import ReentrantCallbackGroup
from rclpy.service import Service
from unilabos_msgs.action import SendCmd
from unilabos_msgs.srv._serial_command import SerialCommand_Request, SerialCommand_Response
from unilabos.config.config import BasicConfig
from unilabos.utils.decorator import get_topic_config, get_all_subscriptions
from unilabos.resources.container import RegularContainer
@@ -911,13 +913,14 @@ class BaseROS2DeviceNode(Node, Generic[T]):
else:
plr_resources.append(ResourceTreeSet([tree]).to_plr_resources()[0])
result, original_instances = _handle_update(plr_resources, tree_set, additional_add_params)
# new_tree_set = ResourceTreeSet.from_plr_resources(original_instances)
# r = SerialCommand.Request()
# r.command = json.dumps(
# {"data": {"data": new_tree_set.dump()}, "action": "update"}) # 和Update Resource一致
# response: SerialCommand_Response = await self._resource_clients[
# "c2s_update_resource_tree"].call_async(r) # type: ignore
# self.lab_logger().info(f"确认资源云端 Update 结果: {response.response}")
if not BasicConfig.no_update_feedback:
new_tree_set = ResourceTreeSet.from_plr_resources(original_instances)
r = SerialCommand.Request()
r.command = json.dumps(
{"data": {"data": new_tree_set.dump()}, "action": "update"}) # 和Update Resource一致
response: SerialCommand_Response = await self._resource_clients[
"c2s_update_resource_tree"].call_async(r) # type: ignore
self.lab_logger().info(f"确认资源云端 Update 结果: {response.response}")
results.append(result)
elif action == "remove":
result = _handle_remove(resources_uuid)