Skip to content
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

fix: removing io error when logging to closed streams #3273

Merged
merged 14 commits into from
Jul 16, 2024

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Jul 12, 2024

Description

Attemp to get rid of:

--- Logging error ---
Traceback (most recent call last):
  File "/__t/Python/3.10.14/x64/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/__t/Python/3.10.14/x64/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/__t/Python/3.10.14/x64/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/__t/Python/3.10.14/x64/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/pool.py", line 907, in _spawn_mapdl
    self._instances[index] = launch_mapdl(
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/launcher.py", line 1795, in launch_mapdl
    port, actual_run_location, process = launch_grpc(
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/launcher.py", line 627, in launch_grpc
    LOG.debug("Checking if gRPC server is alive.")
Message: 'Checking if gRPC server is alive.'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/__t/Python/3.10.14/x64/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/__t/Python/3.10.14/x64/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/__t/Python/3.10.14/x64/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/__t/Python/3.10.14/x64/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/pool.py", line 907, in _spawn_mapdl
    self._instances[index] = launch_mapdl(
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/launcher.py", line 1795, in launch_mapdl
    port, actual_run_location, process = launch_grpc(
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/launcher.py", line 628, in launch_grpc
    _check_server_is_alive(stdout_queue, run_location, timeout)
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/launcher.py", line 695, in _check_server_is_alive
    LOG.debug(f"MAPDL gRPC server successfully launched at: {listening_on}")
Message: 'MAPDL gRPC server successfully launched at: 0.0.0.0:50056'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/__t/Python/3.10.14/x64/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/mapdl_core.py", line 2267, in __del__
    self.exit()
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/errors.py", line 384, in wrapper
    return function(self, *args, **kwargs)
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/mapdl_grpc.py", line 1020, in exit
    if not get_start_instance():
  File "/__t/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/mapdl/core/launcher.py", line 820, in get_start_instance
    LOG.debug(
Message: 'PYMAPDL_START_INSTANCE is unset. Using default value True.'
Arguments: ()

Issue linked

NA

Checklist

@germa89 germa89 self-assigned this Jul 12, 2024
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added the bug Issue, problem or error in PyMAPDL label Jul 12, 2024
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.13%. Comparing base (03f722e) to head (b917af5).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3273      +/-   ##
==========================================
- Coverage   88.22%   87.13%   -1.09%     
==========================================
  Files          53       55       +2     
  Lines        9670     9768      +98     
==========================================
- Hits         8531     8511      -20     
- Misses       1139     1257     +118     

@germa89 germa89 marked this pull request as ready for review July 15, 2024 08:20
@germa89 germa89 requested a review from a team as a code owner July 15, 2024 08:20
@germa89 germa89 requested review from clatapie and pyansys-ci-bot and removed request for a team July 15, 2024 08:20
src/ansys/mapdl/core/mapdl_core.py Show resolved Hide resolved
src/ansys/mapdl/core/mapdl_core.py Outdated Show resolved Hide resolved
@germa89 germa89 requested a review from clatapie July 16, 2024 15:43
@germa89
Copy link
Collaborator Author

germa89 commented Jul 16, 2024

@pyansys-ci-bot LGTM.

Copy link
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89 germa89 merged commit 83b79ff into main Jul 16, 2024
66 checks passed
@germa89 germa89 deleted the fix/removing-IO-error-when-logging-to-closed-streams branch July 16, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue, problem or error in PyMAPDL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants