Skip to content
Open
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
1 change: 1 addition & 0 deletions benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from core.cmd.obj import BenchmarkingJob
from core.__version__ import __version__

utils.patch_sedna_timeouts()

def main():
""" main command-line interface to ianvs"""
Expand Down
1 change: 1 addition & 0 deletions core/cmd/benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from core.cmd.obj import BenchmarkingJob
from core.__version__ import __version__

utils.patch_sedna_timeouts()

def main():
""" main command-line interface to ianvs"""
Expand Down
26 changes: 26 additions & 0 deletions core/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,29 @@ def load_module(url):
sys.path.pop(0)
except Exception as err:
raise RuntimeError(f"load module(url={url}) failed, error: {err}") from err


def patch_sedna_timeouts():
"""Bypass Sedna network timeouts during local offline benchmarking."""
if os.getenv("BYPASS_TIMEOUTS", "1") == "1":
try:
import sedna.service.client
from core.common.log import LOGGER
original_http_request = sedna.service.client.http_request
LOGGER.info("Bypassing Sedna network timeouts is active.")

def patched_http_request(url, *args, **kwargs):
"""Bypass local/invalid HTTP endpoints to speed up offline runs."""
is_local_endpoint = (
not url
or url.startswith("None")
or "127.0.0.1" in url
or "localhost" in url
)
if is_local_endpoint:
raise ConnectionError("Connection refused.")
return original_http_request(url, *args, **kwargs)

sedna.service.client.http_request = patched_http_request
except ImportError:
pass