Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hack that allows specifying the user directory as git #649

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
15 changes: 14 additions & 1 deletion runbenchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import re
import shutil
import sys
from pathlib import Path

# prevent asap other modules from defining the root logger using basicConfig
import amlb.logger

import openml

import amlb
from amlb.utils import Namespace as ns, config_load, datetime_iso, str2bool, str_sanitize, zip_path
from amlb.utils import Namespace as ns, config_load, datetime_iso, str2bool, str_sanitize, zip_path, run_cmd
from amlb import log, AutoMLError
from amlb.defaults import default_dirs

Expand Down Expand Up @@ -99,6 +100,18 @@
# help="The region on which to run the benchmark when using AWS.")

args = parser.parse_args()

GIT_PATTERN = re.compile(r"https://(?:www.)?\w+.\w+/([a-zA-Z0-9_\-\.]+)/([a-zA-Z0-9_\-\.]+).git")
if args.userdir and (match := GIT_PATTERN.match(args.userdir)):
user, repo = match.groups()
DOWNLOAD_DIRECTORY = Path(__file__).parent / "downloads"
download_path = DOWNLOAD_DIRECTORY / user / repo
if not download_path.exists():
download_path.mkdir(parents=True)
cmd = f"clone {args.userdir}"
run_cmd(f"git {cmd} {download_path}", _log_level_=logging.DEBUG)[0].strip()
args.userdir = str(download_path)

script_name = os.path.splitext(os.path.basename(__file__))[0]
extras = {t[0]: t[1] if len(t) > 1 else True for t in [x.split('=', 1) for x in args.extra]}

Expand Down
Loading