Skip to content

Commit

Permalink
Add benchmate
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre.delaunay committed Jun 6, 2024
1 parent bb19430 commit 584a69f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
28 changes: 27 additions & 1 deletion milabench/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ class defines good default behavior.
)


def is_editable_install():
import subprocess
import json

try:
output = subprocess.check_output(["pip", "list", "-e", "--format", "json"])
editable_package = json.loads(output)

for p in editable_package:
if p["name"] == "milabench":
return True
return False
except:
return False


def install_benchmate(pack):
milabench = os.path.dirname(__file__)
benchmate = os.path.join(milabench, "..", "benchmate")
pack.pip_install("-e", benchmate)


class PackageCore:
def __init__(self, config):
self.pack_path = XPath(config["definition"])
Expand Down Expand Up @@ -94,7 +116,7 @@ def __init__(self, config, core=None):
self.config = config
self.phase = None
self.processes = []

def copy(self, config):
return type(self)(config=merge(self.config, config))

Expand Down Expand Up @@ -351,6 +373,10 @@ async def install(self):
milabench in the venv, and then calling this method.
"""
assert self.phase == "install"

if is_editable_install():
install_benchmate(self)

for reqs in self.requirements_files(self.config.get("install_variant", None)):
if reqs.exists():
await self.pip_install("-r", reqs)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ license = "MIT"

[tool.poetry.dependencies]
voir = {git = "https://github.com/breuleux/voir", branch = "master"}
benchmate = {path = "benchmate", develop = false}
python = ">=3.8,<4.0"
giving = "^0.4.0"
ptera = "^1.2.0"
Expand Down

0 comments on commit 584a69f

Please sign in to comment.