Skip to content

fix: avoid returning output when using input grpc method #3759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/3759.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: avoid returning output when using input grpc method
6 changes: 3 additions & 3 deletions src/ansys/mapdl/core/mapdl_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1966,12 +1966,12 @@ def input(
if "CDRE" in orig_cmd.upper():
# Using CDREAD
option = kwargs.get("cd_read_option", "COMB")
tmp_dat = f"/OUT,{tmp_out}\n{orig_cmd},'{option}','{filename}'\n"
tmp_dat = f"/OUT,{tmp_out}\n{orig_cmd},'{option}','{filename}'\n/OUT,"
delete_uploaded_files = False

else:
# Using default INPUT
tmp_dat = f"/OUT,{tmp_out}\n{orig_cmd},'{filename}'\n"
tmp_dat = f"/OUT,{tmp_out}\n{orig_cmd},'{filename}'\n/OUT,"
delete_uploaded_files = True

if write_to_log and self._apdl_log is not None:
Expand All @@ -1991,7 +1991,7 @@ def input(
self._stored_commands.append(tmp_dat.splitlines()[1])
return None

request = pb_types.InputFileRequest(filename=tmp_name)
request = pb_types.InputFileRequest(filename=tmp_name, opt="MUTE")

# even though we don't care about the output, we still
# need to check. otherwise, since inputfile is
Expand Down
3 changes: 2 additions & 1 deletion tests/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,13 @@ def test_read_input_file_verbose(mapdl, cleared):

@pytest.mark.parametrize("file_name", ["full26.dat", "static.dat"])
def test_read_input_file(mapdl, file_name, cleared):
mapdl.prep7()
test_file = os.path.join(PATH, "test_files", file_name)
response = mapdl.input(test_file)

assert (
re.search("\*\*\*\*\* (ANSYS|MAPDL) SOLUTION ROUTINE \*\*\*\*\*", response)
or "PyMAPDL: Simulation Finished." in response
or "***** ROUTINE COMPLETED *****" in response
)


Expand Down