feat: add Runpod serverless image collector pools

This commit is contained in:
Robert Wojciechowski
2026-10-11 04:55:01 +00:00
parent 6f85129e45
commit 1093818327
42 changed files with 5811 additions and 238 deletions
+10 -11
View File
@@ -38,17 +38,10 @@ def _load_config_routes_module():
sys.modules[f"{package_name}.api"] = api_pkg
utils_pkg = types.ModuleType(f"{package_name}.utils")
utils_pkg.__path__ = []
utils_pkg.__path__ = [str(module_path.parents[1] / "utils")]
sys.modules[f"{package_name}.utils"] = utils_pkg
created_aiohttp_stub = False
if "aiohttp" not in sys.modules:
created_aiohttp_stub = True
aiohttp_module = types.ModuleType("aiohttp")
aiohttp_module.web = types.SimpleNamespace(
json_response=lambda payload, status=200: _FakeResponse(payload, status=status)
)
sys.modules["aiohttp"] = aiohttp_module
import aiohttp # Load the real dependency; isolate the fake response at the tested module.
class _Routes:
def get(self, _path):
@@ -96,8 +89,14 @@ def _load_config_routes_module():
assert spec is not None and spec.loader is not None
spec.loader.exec_module(module)
if created_aiohttp_stub:
sys.modules.pop("aiohttp", None)
class _EmptySecretStore:
def has(self, _worker_id):
return False
module.web = types.SimpleNamespace(
json_response=lambda payload, status=200: _FakeResponse(payload, status=status)
)
module._serverless_secret_store = lambda: _EmptySecretStore()
return module
+4
View File
@@ -205,6 +205,10 @@ def _load_job_routes_module():
module = importlib.util.module_from_spec(spec)
assert spec is not None and spec.loader is not None
spec.loader.exec_module(module)
# Keep response assertions independent of real aiohttp import ordering.
module.web = types.SimpleNamespace(
json_response=lambda payload, status=200: _FakeResponse(payload, status=status)
)
if created_aiohttp_stub:
sys.modules.pop("aiohttp", None)
+2
View File
@@ -257,6 +257,8 @@ def _load_worker_routes_module():
module = importlib.util.module_from_spec(spec)
assert spec is not None and spec.loader is not None
spec.loader.exec_module(module)
# Keep this module's response double independent of aiohttp import order.
module.web = types.SimpleNamespace(json_response=lambda payload, status=200: _FakeResponse(payload, status))
if created_aiohttp_stub:
sys.modules.pop("aiohttp", None)