MCPcopy Create free account
hub / github.com/Tong89/smartNode / is_resource_available

Method is_resource_available

backend/core.py:883–901  ·  view source on GitHub ↗
(sat_id, gs_id, relay_id=None, relay2_id=None)

Source from the content-addressed store, hash-verified

881
882 # 资源可用性检查内部函数
883 def is_resource_available(sat_id, gs_id, relay_id=None, relay2_id=None):
884 # ⭐ TASK_CMD/INTEL 完全跳过资源独占检查
885 if is_immediate_type:
886 # 只检查中继带宽
887 if relay_id and not self._check_relay_bandwidth_available(relay_id, 10): return False
888 if relay2_id and not self._check_relay_bandwidth_available(relay2_id, 10): return False
889 return True # 不检查卫星和地面站独占
890
891 # 非立即传输类型
892 if sat_id in self.resource_usage["satellites"] and len(self.resource_usage["satellites"][sat_id]) > 0:
893 # 如果是自己占用的,则允许(比如原始影像等待过境)
894 if req.id not in self.resource_usage["satellites"][sat_id]:
895 return False
896 if gs_id in self.resource_usage["ground_stations"] and len(self.resource_usage["ground_stations"][gs_id]) > 0:
897 return False
898 # 中继带宽检查逻辑
899 if relay_id and not self._check_relay_bandwidth_available(relay_id, 10): return False
900 if relay2_id and not self._check_relay_bandwidth_available(relay2_id, 10): return False
901 return True
902
903 # --- 链路搜索逻辑 (同 _start_transmission) ---
904 # 1. 尝试直连

Callers

nothing calls this directly

Tested by

no test coverage detected