Skip to content

Commit

Permalink
Remove the possibility of having a list of trackers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrija Kolic committed Apr 10, 2024
1 parent e655ab3 commit ed33d2f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
],

"mx_version": "7.19.3",
"mx_version": "7.22.0",

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
Expand Down
2 changes: 1 addition & 1 deletion src/mx/_impl/mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18147,7 +18147,7 @@ def alarm_handler(signum, frame):
_CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache'))

# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
version = VersionSpec("7.22.0") # CMakeNinjaProject support for multitarget
version = VersionSpec("7.22.1") # [GR-53101] Remove possibility of having a list of trackers

_mx_start_datetime = datetime.utcnow()

Expand Down
21 changes: 11 additions & 10 deletions src/mx/_impl/mx_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ def __init__(self, *args, **kwargs):
super(BenchmarkSuite, self).__init__(*args, **kwargs)
self._desired_version = None
self._suite_dimensions: DataPoint = {}
self._command_mapper_hooks = []
self._trackers = []
self._command_mapper_hooks = {}
self._tracker = None
self._currently_running_benchmark = None

def name(self):
Expand Down Expand Up @@ -514,14 +514,15 @@ def register_command_mapper_hook(self, name, func):
"""Registers a function that takes as input the benchmark suite object and the command to execute and returns
a modified command line.
:param string name: Unique name of the hook.
:param function func:
:return: None
"""
self._command_mapper_hooks.append((name, func, self))
self._command_mapper_hooks[name] = func

def register_tracker(self, name, tracker_type):
tracker = tracker_type(self)
self._trackers.append(tracker)
self._tracker = tracker

def hook(cmd, suite):
assert suite == self
Expand Down Expand Up @@ -1283,8 +1284,8 @@ def compiled(pat):

datapoints: List[DataPoint] = []
rules = self.rules(out, benchmarks, bmSuiteArgs)
for t in self._trackers:
rules += t.get_rules(bmSuiteArgs)
if self._tracker is not None:
rules += self._tracker.get_rules(bmSuiteArgs)
rules += extraRules

for rule in rules:
Expand Down Expand Up @@ -1460,9 +1461,9 @@ def vmArgs(self, bmSuiteArgs):

def func(cmd, bmSuite, prefix_command=prefix_command):
return prefix_command + cmd
if self._command_mapper_hooks and profiler not in self._command_mapper_hooks[0]:
mx.abort(f"Profiler '{profiler}' conflicts with trackers '{', '.join([n for n, _, _ in self._command_mapper_hooks])}'\nUse --tracker none to disable all trackers")
self._command_mapper_hooks = [(profiler, func, self)]
if self._command_mapper_hooks and any(hook_name != profiler for hook_name in self._command_mapper_hooks):
mx.abort(f"Profiler '{profiler}' conflicts with trackers '{', '.join([hook_name for hook_name in self._command_mapper_hooks if hook_name != profiler])}'\nUse --tracker none to disable all trackers")
self._command_mapper_hooks = {profiler: func}
return args

def parserNames(self):
Expand Down Expand Up @@ -1520,7 +1521,7 @@ def runAndReturnStdOut(self, benchmarks, bmSuiteArgs):
return 0, "", {}
vm = self.get_vm_registry().get_vm_from_suite_args(bmSuiteArgs)
vm.extract_vm_info(self.vmArgs(bmSuiteArgs))
vm.command_mapper_hooks = self._command_mapper_hooks
vm.command_mapper_hooks = [(name, func, self) for name, func in self._command_mapper_hooks.items()]
t = self._vmRun(vm, cwd, command, benchmarks, bmSuiteArgs)
if len(t) == 2:
ret_code, out = t
Expand Down

0 comments on commit ed33d2f

Please sign in to comment.