Skip to content

made more robust the launch_ironpython_server. now it is checking the aedt_path #983

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 4 commits into from
Mar 24, 2022

Conversation

maxcapodi78
Copy link
Collaborator

… and it is checking if connection to the client is successful before initializing it.

… aedt_path and it is checking if connection to the client is successful before initializing it.
@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #983 (0ec3cf7) into main (ab885f8) will decrease coverage by 14.58%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##             main     #983       +/-   ##
===========================================
- Coverage   80.74%   66.16%   -14.59%     
===========================================
  Files         129      198       +69     
  Lines       38350    46867     +8517     
===========================================
+ Hits        30965    31008       +43     
- Misses       7385    15859     +8474     

@@ -244,6 +245,9 @@ def client(server_name, server_port=18000, beta_options=None):
except:
t -= 1
time.sleep(1)
if not c:
print("Failing to connect to {} on port {}. Check the settings".format(server_name, server_port))
Copy link
Contributor

Choose a reason for hiding this comment

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

These should raise errors.

@@ -244,6 +245,9 @@ def client(server_name, server_port=18000, beta_options=None):
except:
t -= 1
time.sleep(1)
if not c:
print("Failing to connect to {} on port {}. Check the settings".format(server_name, server_port))
Copy link
Contributor

Choose a reason for hiding this comment

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

These should raise errors.

Comment on lines 414 to 415
print("Process {} started on {}".format(proc.pid, socket.getfqdn()))
print("Using port {}".format(port1))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be logged.

Comment on lines 414 to 415
print("Process {} started on {}".format(proc.pid, socket.getfqdn()))
print("Using port {}".format(port1))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be logged.

@MaxJPRey
Copy link
Collaborator

@maxcapodi78 If we decide to go with the log option instead of the print. We cannot use the AEDT message logger because it won't be available.
We could use the root logger instead.
Something like:

import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.CRITICAL)

@maxcapodi78
Copy link
Collaborator Author

@akaszynski That's is the only part of pyaedt not logget because it is the linux client_server. this cannot be logged because nothing is started yet. the logs starts after the client is up and running

from rpyc.utils.server import ThreadedServer
from pyaedt.rpc.rpyc_services import GlobalService, check_port
import rpyc.core.consts
# sys.path.insert(0, os.path.join(pyaedt_path, "third_party", "ironpython"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# sys.path.insert(0, os.path.join(pyaedt_path, "third_party", "ironpython"))

@@ -3,10 +3,15 @@

os.environ["PYAEDT_IRONPYTHON_SERVER"] = "1"
sys.path.append(pyaedt_path)
sys.path.insert(0, os.path.join(pyaedt_path, "pyaedt", "third_party", "ironpython"))
#sys.path.insert(0, os.path.join(pyaedt_path, "pyaedt", "third_party", "ironpython"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#sys.path.insert(0, os.path.join(pyaedt_path, "pyaedt", "third_party", "ironpython"))

@maxcapodi78
Copy link
Collaborator Author

@maxcapodi78 If we decide to go with the log option instead of the print. We cannot use the AEDT message logger because it won't be available. We could use the root logger instead. Something like:

import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.CRITICAL)

@MaxJPRey If it is ok for you we can take in another PR. We need to test the log and see if no issues are in both Windows and Linux, CPython and IPY

@maxcapodi78 maxcapodi78 merged commit 2155ecf into main Mar 24, 2022
@maxcapodi78 maxcapodi78 deleted the enchance_common_rpc branch March 24, 2022 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants