From cf54715cc017dc3707b2e0d876283fe00ea87f9a Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 1 Dec 2023 14:21:51 -0600 Subject: [PATCH 1/9] initial commit, adding nrm-papiwrapper and nrm-geopm binaries to setup --- bindings/python/nrm/setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bindings/python/nrm/setup.py b/bindings/python/nrm/setup.py index 0ecc7fa..3676316 100644 --- a/bindings/python/nrm/setup.py +++ b/bindings/python/nrm/setup.py @@ -78,15 +78,26 @@ def nrmd_waitready(options): @waitretry -def dummy_connect(options): +def dummy_connect(*args): actuators = Client().list_actuators() return "nrm-dummy-extra-actuator" in [act.get_uuid() for act in actuators] +@waitretry +def papi_connect(*args): + sensors = Client().list_sensors() + return any([sensor.get_uuid().startswith("nrm.extra.perf.") for sensor in sensors]) + +@waitretry +def geopm_connect(*args): + actuators = Client().list_actuators() + return "nrm.geopm.cpu.power" in [act.get_uuid() for act in actuators] class Setup: binaries = { "nrmd": NRMBinary("nrmd", False, nrmd_waitready), "nrm-dummy-extra": NRMBinary("nrm-dummy-extra", False, dummy_connect), + "nrm-papiwrapper": NRMBinary("nrm-papiwrapper", False, papi_connect), + "nrm-geopm": NRMBinary("nrm-geopm", False, geopm_connect), } def __init__(self, name, args=[], options={}): From 09c75aaf7a00214bc8ec4da4f08bfb79ed4dbee6 Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 1 Dec 2023 14:24:56 -0600 Subject: [PATCH 2/9] tentative test_setup unit tests to try out each registered binary --- bindings/python/tests/test_setup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bindings/python/tests/test_setup.py b/bindings/python/tests/test_setup.py index c3c9305..883917d 100644 --- a/bindings/python/tests/test_setup.py +++ b/bindings/python/tests/test_setup.py @@ -18,6 +18,17 @@ def test_setup_init(self): with Setup("nrmd", options=options): pass + def test_dummy_extra_init(self): + with Setup("nrm-dummy-extra", options=options): + pass # client capabilities tested in test_client.py - just check we don't crash here + + def test_papiwrapper_init(self): + with Setup("nrm-papiwrapper", options=options): + pass + + def test_geopm_init(self): + with Setup("nrm-geopm", options=options): + pass if __name__ == "__main__": unittest.main() From 03fba8e780434a2205074b50fec6c129e202aa24 Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 7 Dec 2023 13:44:25 -0600 Subject: [PATCH 3/9] removes nrm-papiwrapper as "setup-able" binary. initial commit for a client.run() --- bindings/python/nrm/client.py | 32 +++++++++++++++++++++++++++++++- bindings/python/nrm/setup.py | 6 ------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index 32e645b..10962cc 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -6,8 +6,14 @@ # # SPDX-License-Identifier: BSD-3-Clause -from ctypes import byref, POINTER, c_void_p, c_double +import os +import logging +import subprocess +from pathlib import Path +from typing import List, Union from dataclasses import dataclass +from ctypes import byref, POINTER, c_void_p, c_double + from .base import ( Error, _nrm_get_function, @@ -128,6 +134,8 @@ "nrm_actuator_list_choices", [nrm_actuator, POINTER(nrm_vector)] ) +_logger = logging.getLogger("nrm") + class Client: """Client class for interacting with NRM C interface. @@ -159,6 +167,28 @@ def __init__( byref(self.client), self.uri, self.pub_port, self.rpc_port ) + @classmethod + def _setup_preloads(preloads): + preloads = ":".join([str(Path(path).absolute()) for path in preloads]) + if len(preloads): + os.environ["LD_PRELOAD"] = preloads + + def run(self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = []): + cmd = [cmd] if isinstance(cmd, str) else cmd + Client._setup_preloads(preloads) + try: + with open(cmd[0]+".out", "w") as stdout, open(cmd[0]+".err", "w") as stderr: + _logger.debug("Launching " + str(cmd)) + self.process = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) + except Exception as e: + _logger.error("Error on launch: ", e.__class__, e.args) + raise e + + def papi_run(self, cmd: Union[str, List[str]], events: List[str] = ["PAPI_TOT_INS"], freq: float = 1.0): + cmd = [cmd] if isinstance(cmd, str) else cmd + Client._setup_preloads(preloads) + pass + def list_sensors(self) -> list: vector = nrm_vector(0) nrm_client_list_sensors(self.client, byref(vector)) diff --git a/bindings/python/nrm/setup.py b/bindings/python/nrm/setup.py index 3676316..8bff60e 100644 --- a/bindings/python/nrm/setup.py +++ b/bindings/python/nrm/setup.py @@ -82,11 +82,6 @@ def dummy_connect(*args): actuators = Client().list_actuators() return "nrm-dummy-extra-actuator" in [act.get_uuid() for act in actuators] -@waitretry -def papi_connect(*args): - sensors = Client().list_sensors() - return any([sensor.get_uuid().startswith("nrm.extra.perf.") for sensor in sensors]) - @waitretry def geopm_connect(*args): actuators = Client().list_actuators() @@ -96,7 +91,6 @@ class Setup: binaries = { "nrmd": NRMBinary("nrmd", False, nrmd_waitready), "nrm-dummy-extra": NRMBinary("nrm-dummy-extra", False, dummy_connect), - "nrm-papiwrapper": NRMBinary("nrm-papiwrapper", False, papi_connect), "nrm-geopm": NRMBinary("nrm-geopm", False, geopm_connect), } From 7f86a726820b58fb8a333a26bc7f43708ad91bfd Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 7 Dec 2023 16:21:08 -0600 Subject: [PATCH 4/9] container dataclass for commands run via client --- bindings/python/nrm/client.py | 31 +++++++++++++++++++--------- bindings/python/tests/test_client.py | 4 ++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index 10962cc..96c90bc 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -10,7 +10,7 @@ import logging import subprocess from pathlib import Path -from typing import List, Union +from typing import List, Union, Optional from dataclasses import dataclass from ctypes import byref, POINTER, c_void_p, c_double @@ -136,6 +136,20 @@ _logger = logging.getLogger("nrm") +@dataclass +class _ClientExec: + cmd: list + stdout: Path + stderr: Path + process: subprocess.Popen = None + errcode: int = -1 + preloads: str = "" + + def _setup_preloads(self, preloads): + preloads = ":".join([str(Path(path).absolute()) for path in preloads]) + if len(preloads): + os.environ["LD_PRELOAD"] = preloads + self.preloads = preloads class Client: """Client class for interacting with NRM C interface. @@ -159,6 +173,7 @@ def __init__( self.pub_port = pub_port if pub_port else upstream_pub_port self.rpc_port = rpc_port if rpc_port else upstream_rpc_port self.client = nrm_client(0) + self.runs = [] if isinstance(self.uri, str): self.uri = bytes(self.uri, "utf-8") @@ -167,19 +182,15 @@ def __init__( byref(self.client), self.uri, self.pub_port, self.rpc_port ) - @classmethod - def _setup_preloads(preloads): - preloads = ":".join([str(Path(path).absolute()) for path in preloads]) - if len(preloads): - os.environ["LD_PRELOAD"] = preloads - def run(self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = []): cmd = [cmd] if isinstance(cmd, str) else cmd - Client._setup_preloads(preloads) + execcmd = _ClientExec(cmd=cmd, stdout=cmd[0]+".out", stderr=cmd[0]+".err") + execcmd._setup_preloads(preloads) try: - with open(cmd[0]+".out", "w") as stdout, open(cmd[0]+".err", "w") as stderr: + with open(execcmd.stdout, "w") as stdout, open(execcmd.stderr, "w") as stderr: _logger.debug("Launching " + str(cmd)) - self.process = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) + execcmd.process = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) + self.runs.append(execcmd) except Exception as e: _logger.error("Error on launch: ", e.__class__, e.args) raise e diff --git a/bindings/python/tests/test_client.py b/bindings/python/tests/test_client.py index 0cc7edc..af58b8d 100644 --- a/bindings/python/tests/test_client.py +++ b/bindings/python/tests/test_client.py @@ -69,6 +69,10 @@ def test_actuator_values_from_extra(self): assert dummy_act.list_choices() == [0.0, 1.0] assert len(dummy_act.get_clientid()) + def test_client_run(self): + with Setup("nrmd", options=options): + client = Client() + client.run("ls") if __name__ == "__main__": unittest.main() From 7ae88000a07abfc0fc8ad0cf392aee1648c34ee7 Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 8 Dec 2023 10:52:58 -0600 Subject: [PATCH 5/9] improvements. class wrappers for process.wait, process.poll --- bindings/python/nrm/client.py | 12 ++++++++++-- bindings/python/tests/test_client.py | 3 ++- bindings/python/tests/test_setup.py | 6 +----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index 96c90bc..ff6b49d 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -137,7 +137,7 @@ _logger = logging.getLogger("nrm") @dataclass -class _ClientExec: +class ClientExec: cmd: list stdout: Path stderr: Path @@ -151,6 +151,13 @@ def _setup_preloads(self, preloads): os.environ["LD_PRELOAD"] = preloads self.preloads = preloads + def wait(self, timeout=None): + return self.process.wait(timeout=timeout) + + def poll(self): + self.errcode = seslf.process.poll() + return self.errcode + class Client: """Client class for interacting with NRM C interface. Tentative usage: @@ -184,13 +191,14 @@ def __init__( def run(self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = []): cmd = [cmd] if isinstance(cmd, str) else cmd - execcmd = _ClientExec(cmd=cmd, stdout=cmd[0]+".out", stderr=cmd[0]+".err") + execcmd = ClientExec(cmd=cmd, stdout=cmd[0]+"-stdout.log", stderr=cmd[0]+"-stderr.log") execcmd._setup_preloads(preloads) try: with open(execcmd.stdout, "w") as stdout, open(execcmd.stderr, "w") as stderr: _logger.debug("Launching " + str(cmd)) execcmd.process = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) self.runs.append(execcmd) + return execcmd except Exception as e: _logger.error("Error on launch: ", e.__class__, e.args) raise e diff --git a/bindings/python/tests/test_client.py b/bindings/python/tests/test_client.py index af58b8d..76df8e3 100644 --- a/bindings/python/tests/test_client.py +++ b/bindings/python/tests/test_client.py @@ -72,7 +72,8 @@ def test_actuator_values_from_extra(self): def test_client_run(self): with Setup("nrmd", options=options): client = Client() - client.run("ls") + cmd = client.run("ls") + cmd.wait(timeout=1) if __name__ == "__main__": unittest.main() diff --git a/bindings/python/tests/test_setup.py b/bindings/python/tests/test_setup.py index 883917d..242ef00 100644 --- a/bindings/python/tests/test_setup.py +++ b/bindings/python/tests/test_setup.py @@ -19,13 +19,9 @@ def test_setup_init(self): pass def test_dummy_extra_init(self): - with Setup("nrm-dummy-extra", options=options): + with Setup("nrmd", options=options), Setup("nrm-dummy-extra", options=options): pass # client capabilities tested in test_client.py - just check we don't crash here - def test_papiwrapper_init(self): - with Setup("nrm-papiwrapper", options=options): - pass - def test_geopm_init(self): with Setup("nrm-geopm", options=options): pass From 483a51703e3da66fad75d4b4ef62cb94c5d85f1f Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 8 Dec 2023 16:57:02 -0600 Subject: [PATCH 6/9] first draft of client.papi_run() --- bindings/python/nrm/client.py | 9 ++++++--- bindings/python/tests/test_client.py | 18 ++++++++++++++++++ bindings/python/tests/test_setup.py | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index ff6b49d..0b28c1b 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -7,6 +7,7 @@ # SPDX-License-Identifier: BSD-3-Clause import os +import shutil import logging import subprocess from pathlib import Path @@ -203,10 +204,12 @@ def run(self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = []) _logger.error("Error on launch: ", e.__class__, e.args) raise e - def papi_run(self, cmd: Union[str, List[str]], events: List[str] = ["PAPI_TOT_INS"], freq: float = 1.0): + def papi_run(self, cmd: Union[str, List[str]], events: List[str] = ["PAPI_TOT_INS"], freq: float = 1.0, preloads: List[Union[str, Path]] = []): + papiwrapper = shutil.which("nrm-papiwrapper") cmd = [cmd] if isinstance(cmd, str) else cmd - Client._setup_preloads(preloads) - pass + eevents = ["-e "+ event for event in events] + cmd = [papiwrapper] + eevents + cmd # should resemble /usr/bin/nrm-papiwrapper -e PAPI_TOT_INS ./app + return self.run(cmd, preloads) def list_sensors(self) -> list: vector = nrm_vector(0) diff --git a/bindings/python/tests/test_client.py b/bindings/python/tests/test_client.py index 76df8e3..c927715 100644 --- a/bindings/python/tests/test_client.py +++ b/bindings/python/tests/test_client.py @@ -74,6 +74,24 @@ def test_client_run(self): client = Client() cmd = client.run("ls") cmd.wait(timeout=1) + assert all(f in os.listdir(".") for f in ["ls-stdout.log", "ls-stderr.log"]) + with open("ls-stdout.log", "r") as f: + assert len(f.readlines()) + + def test_client_run_preload(self): + with Setup("nrmd", options=options): + client = Client() + cmd = client.run("who", preloads=[os.environ.get("LIBNRM_SO_")]) + cmd.wait(timeout=1) + + def test_client_papi_run(self): + with Setup("nrmd", options=options): + client = Client() + cmd = client.papi_run("ls", events=["PAPI_TOT_INS"]) + cmd.wait(timeout=1) + assert all(f in os.listdir(".") for f in ["ls-stdout.log", "ls-stderr.log"]) + with open("ls-stdout.log", "r") as f: + assert len(f.readlines()) if __name__ == "__main__": unittest.main() diff --git a/bindings/python/tests/test_setup.py b/bindings/python/tests/test_setup.py index 242ef00..00c554e 100644 --- a/bindings/python/tests/test_setup.py +++ b/bindings/python/tests/test_setup.py @@ -23,7 +23,7 @@ def test_dummy_extra_init(self): pass # client capabilities tested in test_client.py - just check we don't crash here def test_geopm_init(self): - with Setup("nrm-geopm", options=options): + with Setup("nrmd", options=options), Setup("nrm-geopm", options=options): pass if __name__ == "__main__": From c99fcb5a306f4de1e74732cd1913c0d157ea114f Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 15 Dec 2023 13:54:20 -0600 Subject: [PATCH 7/9] fix typo, test poll, implement frequency into papi_run. raise FileNotFoundError if nrm-papiwrapper not found on path --- bindings/python/nrm/client.py | 6 ++++-- bindings/python/tests/test_client.py | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index 0b28c1b..d45a051 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -156,7 +156,7 @@ def wait(self, timeout=None): return self.process.wait(timeout=timeout) def poll(self): - self.errcode = seslf.process.poll() + self.errcode = self.process.poll() return self.errcode class Client: @@ -206,9 +206,11 @@ def run(self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = []) def papi_run(self, cmd: Union[str, List[str]], events: List[str] = ["PAPI_TOT_INS"], freq: float = 1.0, preloads: List[Union[str, Path]] = []): papiwrapper = shutil.which("nrm-papiwrapper") + if not papiwrapper: + raise FileNotFoundError("Unable to find nrm-papiwrapper") cmd = [cmd] if isinstance(cmd, str) else cmd eevents = ["-e "+ event for event in events] - cmd = [papiwrapper] + eevents + cmd # should resemble /usr/bin/nrm-papiwrapper -e PAPI_TOT_INS ./app + cmd = [papiwrapper] + ["-f", str(freq)] + eevents + cmd # should resemble /usr/bin/nrm-papiwrapper -f 1 -e PAPI_TOT_INS ./app return self.run(cmd, preloads) def list_sensors(self) -> list: diff --git a/bindings/python/tests/test_client.py b/bindings/python/tests/test_client.py index c927715..5b45d7a 100644 --- a/bindings/python/tests/test_client.py +++ b/bindings/python/tests/test_client.py @@ -78,6 +78,13 @@ def test_client_run(self): with open("ls-stdout.log", "r") as f: assert len(f.readlines()) + def test_client_run_poll(self): + with Setup("nrmd", options=options): + client = Client() + cmd = client.run(["sleep", "2"]) + assert cmd.poll() + cmd.wait() + def test_client_run_preload(self): with Setup("nrmd", options=options): client = Client() From da5d9309245c974e9bcf29283006f572b9ff21b9 Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 15 Dec 2023 15:11:35 -0600 Subject: [PATCH 8/9] formatting --- bindings/python/nrm/client.py | 34 ++++++++++++++++++++++------ bindings/python/nrm/setup.py | 2 ++ bindings/python/tests/test_client.py | 11 +++++++-- bindings/python/tests/test_setup.py | 9 ++++++-- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index d45a051..e04ec8f 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -137,6 +137,7 @@ _logger = logging.getLogger("nrm") + @dataclass class ClientExec: cmd: list @@ -159,6 +160,7 @@ def poll(self): self.errcode = self.process.poll() return self.errcode + class Client: """Client class for interacting with NRM C interface. Tentative usage: @@ -190,27 +192,45 @@ def __init__( byref(self.client), self.uri, self.pub_port, self.rpc_port ) - def run(self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = []): + def run( + self, cmd: Union[str, List[str]], preloads: List[Union[str, Path]] = [] + ): cmd = [cmd] if isinstance(cmd, str) else cmd - execcmd = ClientExec(cmd=cmd, stdout=cmd[0]+"-stdout.log", stderr=cmd[0]+"-stderr.log") + execcmd = ClientExec( + cmd=cmd, + stdout=cmd[0] + "-stdout.log", + stderr=cmd[0] + "-stderr.log", + ) execcmd._setup_preloads(preloads) try: - with open(execcmd.stdout, "w") as stdout, open(execcmd.stderr, "w") as stderr: + with open(execcmd.stdout, "w") as stdout, open( + execcmd.stderr, "w" + ) as stderr: _logger.debug("Launching " + str(cmd)) - execcmd.process = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) + execcmd.process = subprocess.Popen( + cmd, stdout=stdout, stderr=stderr + ) self.runs.append(execcmd) return execcmd except Exception as e: _logger.error("Error on launch: ", e.__class__, e.args) raise e - def papi_run(self, cmd: Union[str, List[str]], events: List[str] = ["PAPI_TOT_INS"], freq: float = 1.0, preloads: List[Union[str, Path]] = []): + def papi_run( + self, + cmd: Union[str, List[str]], + events: List[str] = ["PAPI_TOT_INS"], + freq: float = 1.0, + preloads: List[Union[str, Path]] = [], + ): papiwrapper = shutil.which("nrm-papiwrapper") if not papiwrapper: raise FileNotFoundError("Unable to find nrm-papiwrapper") cmd = [cmd] if isinstance(cmd, str) else cmd - eevents = ["-e "+ event for event in events] - cmd = [papiwrapper] + ["-f", str(freq)] + eevents + cmd # should resemble /usr/bin/nrm-papiwrapper -f 1 -e PAPI_TOT_INS ./app + eevents = ["-e " + event for event in events] + cmd = ( + [papiwrapper] + ["-f", str(freq)] + eevents + cmd + ) # should resemble /usr/bin/nrm-papiwrapper -f 1 -e PAPI_TOT_INS ./app return self.run(cmd, preloads) def list_sensors(self) -> list: diff --git a/bindings/python/nrm/setup.py b/bindings/python/nrm/setup.py index 8bff60e..89e2977 100644 --- a/bindings/python/nrm/setup.py +++ b/bindings/python/nrm/setup.py @@ -82,11 +82,13 @@ def dummy_connect(*args): actuators = Client().list_actuators() return "nrm-dummy-extra-actuator" in [act.get_uuid() for act in actuators] + @waitretry def geopm_connect(*args): actuators = Client().list_actuators() return "nrm.geopm.cpu.power" in [act.get_uuid() for act in actuators] + class Setup: binaries = { "nrmd": NRMBinary("nrmd", False, nrmd_waitready), diff --git a/bindings/python/tests/test_client.py b/bindings/python/tests/test_client.py index 5b45d7a..a1d9f4b 100644 --- a/bindings/python/tests/test_client.py +++ b/bindings/python/tests/test_client.py @@ -74,7 +74,10 @@ def test_client_run(self): client = Client() cmd = client.run("ls") cmd.wait(timeout=1) - assert all(f in os.listdir(".") for f in ["ls-stdout.log", "ls-stderr.log"]) + assert all( + f in os.listdir(".") + for f in ["ls-stdout.log", "ls-stderr.log"] + ) with open("ls-stdout.log", "r") as f: assert len(f.readlines()) @@ -96,9 +99,13 @@ def test_client_papi_run(self): client = Client() cmd = client.papi_run("ls", events=["PAPI_TOT_INS"]) cmd.wait(timeout=1) - assert all(f in os.listdir(".") for f in ["ls-stdout.log", "ls-stderr.log"]) + assert all( + f in os.listdir(".") + for f in ["ls-stdout.log", "ls-stderr.log"] + ) with open("ls-stdout.log", "r") as f: assert len(f.readlines()) + if __name__ == "__main__": unittest.main() diff --git a/bindings/python/tests/test_setup.py b/bindings/python/tests/test_setup.py index 00c554e..839e93e 100644 --- a/bindings/python/tests/test_setup.py +++ b/bindings/python/tests/test_setup.py @@ -19,12 +19,17 @@ def test_setup_init(self): pass def test_dummy_extra_init(self): - with Setup("nrmd", options=options), Setup("nrm-dummy-extra", options=options): + with Setup("nrmd", options=options), Setup( + "nrm-dummy-extra", options=options + ): pass # client capabilities tested in test_client.py - just check we don't crash here def test_geopm_init(self): - with Setup("nrmd", options=options), Setup("nrm-geopm", options=options): + with Setup("nrmd", options=options), Setup( + "nrm-geopm", options=options + ): pass + if __name__ == "__main__": unittest.main() From 4854b8be4eb0d62dd427bd745f34bd402469bfaa Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 15 Dec 2023 15:32:33 -0600 Subject: [PATCH 9/9] formatting --- bindings/python/nrm/client.py | 4 ++-- bindings/python/tests/test_setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/python/nrm/client.py b/bindings/python/nrm/client.py index e04ec8f..a187a42 100644 --- a/bindings/python/nrm/client.py +++ b/bindings/python/nrm/client.py @@ -11,7 +11,7 @@ import logging import subprocess from pathlib import Path -from typing import List, Union, Optional +from typing import List, Union from dataclasses import dataclass from ctypes import byref, POINTER, c_void_p, c_double @@ -230,7 +230,7 @@ def papi_run( eevents = ["-e " + event for event in events] cmd = ( [papiwrapper] + ["-f", str(freq)] + eevents + cmd - ) # should resemble /usr/bin/nrm-papiwrapper -f 1 -e PAPI_TOT_INS ./app + ) # should resemble /usr/bin/nrm-papiwrapper -f 1 -e PAPI_EVENT ./app return self.run(cmd, preloads) def list_sensors(self) -> list: diff --git a/bindings/python/tests/test_setup.py b/bindings/python/tests/test_setup.py index 839e93e..4125359 100644 --- a/bindings/python/tests/test_setup.py +++ b/bindings/python/tests/test_setup.py @@ -22,7 +22,7 @@ def test_dummy_extra_init(self): with Setup("nrmd", options=options), Setup( "nrm-dummy-extra", options=options ): - pass # client capabilities tested in test_client.py - just check we don't crash here + pass # client tested in test_client.py - just check no crash def test_geopm_init(self): with Setup("nrmd", options=options), Setup(