Commit c0dc1515 authored by Zixian Cai's avatar Zixian Cai

Support reading Zebu version from dynamic library

parent 256bc940
......@@ -43,7 +43,8 @@ def local(file, pipeline, skip_compile, dump):"Running tasks specified in file")
if pipeline:
go_through_pipelines(revision.tasksets, pipeline_names=pipeline.split(","))
if dump:"Dumping log to {}".format(dump))
with open(dump, "w") as logfile:
......@@ -15,7 +15,7 @@
import logging
from mubench.models.pipeline import pipelines
from mubench.util import get_cpu_info, get_hostname, get_uname
from mubench.util import get_cpu_info, get_hostname, get_uname, get_zebu_ver
from collections import defaultdict
from mubench.models.trails import Trails
......@@ -32,7 +32,8 @@ def platform_info():
return {
"cpu": get_cpu_info(),
"uname": get_uname(),
"hostname": get_hostname()
"hostname": get_hostname(),
"zebu": get_zebu_ver()
......@@ -20,6 +20,9 @@ import logging
import subprocess as subproc
import platform
from types import SimpleNamespace
from mubench.conf import settings
from pathlib import Path
import ctypes
logger = logging.getLogger(__name__)
......@@ -98,3 +101,17 @@ def get_uname():
def get_hostname():
return platform.node()
def get_zebu_ver():
mudir = Path(settings.ENVIRON["MU_ZEBU"])
libmu_dir = mudir / 'target' / settings.ENVIRON.get('ZEBU_BUILD', 'release')
if platform.system() == "Linux":
dll_ext = ".so"
elif platform.system() == "Darwin":
dll_ext = ".dylib"
dll_ext = ".dll"
libmu = ctypes.CDLL("{}/libmu{}".format(libmu_dir, dll_ext))
libmu.mu_get_version.restype = ctypes.c_char_p
return libmu.mu_get_version().decode("utf-8").strip()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment