diff --git a/src/ansys/mapdl/core/mapdl_grpc.py b/src/ansys/mapdl/core/mapdl_grpc.py index 3a7e3bf0f6..76292cb6bc 100644 --- a/src/ansys/mapdl/core/mapdl_grpc.py +++ b/src/ansys/mapdl/core/mapdl_grpc.py @@ -1411,18 +1411,19 @@ def _download(targets: List[str]) -> None: return os.path.join(path, jobname + "0." + preference) @protect_grpc - def _ctrl(self, cmd): - """Issue control command to the mapdl server + def _ctrl(self, cmd: str, opt1: str = ""): + """Issue control command to the MAPDL server. Available commands: - - 'EXIT' + - ``EXIT`` Calls exit(0) on the server. - - 'set_verb' + - ``set_verb`` Enables verbose mode on the server. + In this case, the verbosity level is set using ``opt1`` argument. - - 'VERSION' + - ``VERSION`` Returns version string in of the server in the form "MAJOR.MINOR.PATCH". E.g. "0.3.0". Known versions include: @@ -1433,16 +1434,16 @@ def _ctrl(self, cmd): Unavailable/Flaky: - - 'time_stats' + - ``time_stats`` Prints a table for time stats on the server. This command appears to be disabled/broken. - - 'mem-stats' + - ``mem-stats`` To be added """ - self._log.debug('Issuing CtrlRequest "%s"', cmd) - request = anskernel.CtrlRequest(ctrl=cmd) + self._log.debug(f'Issuing CtrlRequest "{cmd}" with option "{opt1}".') + request = anskernel.CtrlRequest(ctrl=str(cmd), opt1=str(opt1)) # handle socket closing upon exit if cmd.lower() == "exit": diff --git a/tests/test_mapdl.py b/tests/test_mapdl.py index 60337e23a3..d3d9a2d60a 100644 --- a/tests/test_mapdl.py +++ b/tests/test_mapdl.py @@ -2447,3 +2447,8 @@ def test_not_correct_et_element(mapdl): mapdl.et(1, 227) with pytest.warns(UserWarning, match="is normal behavior when a CDB file is used"): mapdl.keyopt(1, 222) + + +def test_ctrl(mapdl): + mapdl._ctrl("set_verb", 5) # Setting verbosity on the server + mapdl._ctrl("set_verb", 0) # Returning to non-verbose