feat(simulation): integrate infrastructure jobs and semantic scene editing
Integrate infrastructure preparation and qualified map delivery with local scenes. Add semantic editing, object provenance, survey caching and operator scene tools.
This commit is contained in:
@@ -40,7 +40,9 @@ class CoreClient:
|
||||
self.instance = instance
|
||||
self._connections = threading.local()
|
||||
|
||||
def request(self, path: str, body=None):
|
||||
def request(self, path: str, body=None, *, max_response_bytes=4 * 1024**2):
|
||||
if not 0 < max_response_bytes <= 24 * 1024**2:
|
||||
raise ValueError("Core response budget exceeds bounded transport")
|
||||
connection = getattr(self._connections, "connection", None)
|
||||
if (
|
||||
connection is not None
|
||||
@@ -63,8 +65,8 @@ class CoreClient:
|
||||
},
|
||||
)
|
||||
response = connection.getresponse()
|
||||
raw = response.read(4 * 1024**2 + 1)
|
||||
if len(raw) > 4 * 1024**2:
|
||||
raw = response.read(max_response_bytes + 1)
|
||||
if len(raw) > max_response_bytes:
|
||||
raise RuntimeError("Core response exceeds admitted size")
|
||||
if response.status not in (200, 201):
|
||||
try:
|
||||
@@ -98,7 +100,7 @@ class CoreClient:
|
||||
PREFIX + "/worlds/" + world["world_id"] + "/source.ply", world, target, pulse=pulse
|
||||
)
|
||||
|
||||
def download_asset(self, path: str, descriptor: dict, target: Path, pulse=None):
|
||||
def download_asset(self, path: str, descriptor: dict, target: Path, pulse=None, *, authenticated=False):
|
||||
if not path.startswith("/api/v1/") or ".." in path or "\\" in path:
|
||||
raise ValueError("Invalid Core asset path")
|
||||
world = descriptor
|
||||
@@ -109,7 +111,8 @@ class CoreClient:
|
||||
try:
|
||||
if pulse:
|
||||
pulse()
|
||||
connection.request("GET", path)
|
||||
connection.request("GET", path, headers={"Authorization": "Bearer " + self.token}
|
||||
if authenticated else {})
|
||||
response = connection.getresponse()
|
||||
if pulse:
|
||||
pulse()
|
||||
|
||||
Reference in New Issue
Block a user