Skip to content

Commit

Permalink
Merge pull request #414 from dyson-ai/feature/update_from_template
Browse files Browse the repository at this point in the history
Feature/update from template
  • Loading branch information
blooop authored Jun 16, 2024
2 parents c49bbfc + 0e3c7e0 commit 09cd066
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 345 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ log/**
.pixi
*.egg-info

managed_context/metadata.json
test_suite_analysis/metadata.json
3 changes: 1 addition & 2 deletions bencher.deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ apt_tools:
- jq

pip_language-toolchain:
- flit
- flit #pixi autocomplete does not work with this removed, #TODO fix
- pip #updates to latest pip


script_pixi-user:
- scripts/install_pixi.sh
115 changes: 6 additions & 109 deletions bencher/bench_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,112 +157,9 @@ def publish_args(branch_name) -> Tuple[str, str]:

return publish_url


# def append(self,pane):
# self.report.append(pane)

# def __getstate__(self):
# state = self.__dict__.copy()
# # Don't pickle baz
# del state["pane"]
# return state

# def __setstate__(self, state):
# self.__dict__.update(state)
# # Add baz back since it doesn't exist in the pickle
# self.report = []

# def publish_old(
# self,
# directory: str = "bench_results",
# branch_name: str = "bench_results",
# url_postprocess: Callable = None,
# **kwargs,
# ) -> str:
# """Publish the results as an html file by committing it to the bench_results branch in the current repo. If you have set up your repo with github pages or equivalent then the html file will be served as a viewable webpage.

# Args:
# directory (str, optional): Directory to save the results. Defaults to "bench_results".
# branch_name (str, optional): Branch to publish on. Defaults to "bench_results".
# url_postprocess (Callable, optional): A function that maps the origin url to a github pages url. Pass your own function if you are using another git providers. Defaults to None.

# Returns:
# str: _description_
# """

# def get_output(cmd: str) -> str:
# return (
# subprocess.run(cmd.split(" "), stdout=subprocess.PIPE, check=False)
# .stdout.decode("utf=8")
# .strip()
# )

# def postprocess_url(publish_url: str, branch_name: str, report_path: str, **kwargs) -> str:
# # import re

# # return re.sub(
# # """((git|ssh|http(s)?)|(git@[\w\.-]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?""",
# # """https://$7/""",
# # publish_url,
# # )
# # git@github.com:user/project.git
# # https://github.com/user/project.git
# # http://github.com/user/project.git
# # git@192.168.101.127:user/project.git
# # https://192.168.101.127/user/project.git
# # http://192.168.101.127/user/project.git
# # ssh://user@host.xz:port/path/to/repo.git/
# # ssh://user@host.xz/path/to/repo.git/
# # ssh://host.xz:port/path/to/repo.git/
# # ssh://host.xz/path/to/repo.git/
# # ssh://user@host.xz/path/to/repo.git/
# # ssh://host.xz/path/to/repo.git/
# # ssh://user@host.xz/~user/path/to/repo.git/
# # ssh://host.xz/~user/path/to/repo.git/
# # ssh://user@host.xz/~/path/to/repo.git
# # ssh://host.xz/~/path/to/repo.git
# # git://host.xz/path/to/repo.git/
# # git://host.xz/~user/path/to/repo.git/
# # http://host.xz/path/to/repo.git/
# # https://host.xz/path/to/repo.git/
# # https://regex101.com/r/qT7NP0/3

# return publish_url.replace(".git", f"/blob/{directory}/{report_path}")

# if url_postprocess is None:
# url_postprocess = postprocess_url
# current_branch = get_output("git symbolic-ref --short HEAD")
# logging.info(f"on branch: {current_branch}")
# stash_msg = get_output("git stash")
# logging.info(f"stashing current work :{stash_msg}")
# checkout_msg = get_output(f"git checkout -b {branch_name}")
# checkout_msg = get_output(f"git checkout {branch_name}")
# get_output("git pull")

# logging.info(f"checking out branch: {checkout_msg}")
# report_path = self.save(directory, in_html_folder=False)
# logging.info(f"created report at: {report_path.absolute()}")
# # commit_msg = f""
# logging.info("adding report to git")
# get_output(f"git add {report_path.absolute()}")
# get_output("git status")
# logging.info("committing report")
# cmd = f'git commit -m "generate_report:{self.bench_name}"'
# logging.info(cmd)
# get_output(cmd)
# logging.info("pushing report to origin")
# get_output(f"git push --set-upstream origin {branch_name}")
# logging.info("checking out original branch")
# get_output(f"git checkout {current_branch}")
# if "No local changes" not in stash_msg:
# logging.info("restoring work with git stash pop")
# get_output("git stash pop")

# publish_url = get_output("git remote get-url --push origin")
# logging.info(f"raw url:{publish_url}")
# publish_url = url_postprocess(
# publish_url, branch_name=branch_name, report_path=report_path, **kwargs
# )
# logging.info("Published report @")
# logging.info(publish_url)
# return publish_url
# @staticmethod
# def publish_github(github_user: str, repo_name: str, branch_name: str) -> Tuple[str, str]:
# return (
# f"https://github.com/{github_user}/{repo_name}.git",
# f"https://github.com/{github_user}/{repo_name}/blob/{branch_name}",
# )
Loading

0 comments on commit 09cd066

Please sign in to comment.