driazati commented on code in PR #11839:
URL: https://github.com/apache/tvm/pull/11839#discussion_r908641673
##########
python/tvm/testing/utils.py:
##########
@@ -1613,6 +1615,51 @@ def is_ampere_or_newer():
return major >= 8
+def install_request_hook(depth: int) -> None:
+ """Add a wrapper around urllib.request for CI tests"""
+ if not IS_IN_CI:
+ return
+
+ #
https://sphinx-gallery.github.io/stable/faq.html#why-is-file-not-defined-what-can-i-use
+ base = None
+ msg = ""
+ try:
+ base = __file__
+ msg += f"found file {__file__}\n"
+ except NameError:
+ msg += f"no file\n"
+
+ if base is None:
+ hook_script_dir = Path.cwd().resovle()
+ msg += "used path.cwd()\n"
+ else:
+ hook_script_dir = Path(base).resolve().parent
+ msg += "used base()\n"
+
+ msg += f"using depth {depth}\n"
+ if depth <= 0:
+ raise ValueError(f"depth less than 1 not supported, found: {depth}")
+
+ # Go up the parent directories
+ while depth > 0:
+ msg += f"[depth={depth}] dir={hook_script_dir}\n"
+ hook_script_dir = hook_script_dir.parent
+ depth -= 1
+
+ # Ensure the specified dir is valid
+ hook_script_dir = hook_script_dir / "tests" / "scripts" / "request_hook"
+ if not hook_script_dir.exists():
+ raise RuntimeError(f"Directory {hook_script_dir} does not
exist:\n{msg}")
+
+ # Import the hook and start it up (it's not included here directly to avoid
+ # keeping a database of URLs inside the tvm Python package
Review Comment:
that seems like the complexity is the same as this method (i.e. find a file,
load it up) but more limited in functionality. I updated the list to
de-duplicate the S3 bucket name to make it clearer the use of keeping it all
Python
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]