+
Skip to content

Conversation

chenchienjacklin
Copy link
Collaborator

@chenchienjacklin
Copy link
Collaborator Author

Resue the session if it already exists.
Will need to implement health check to attach to a running server.
Tested scenarios

if MOD.current_session is not None:
    MOD.current_session.disconnect()
print("Before launch_session")
print(f"MOD.current_session: {MOD.current_session}")

# If there is no active session and no server executable listening on the provided port, start the server executable and attach to it.
session = launch_session(EXE_DIR, 50051)
print(f"session: {session}")

# If a session already exists on the provided port, reuse it
session2 = launch_session(EXE_DIR, 50051)
print(f"session: {session2}")

# If a session already exists but it is on a different port than requested, throw an error
try:
    session3 = launch_session(EXE_DIR, 50052)
except Exception as e:
    print(e)

Results

Before launch_session
MOD.current_session: None
session: <ansys.edb.core.session._Session object at 0x000001888E41B940>
session: <ansys.edb.core.session._Session object at 0x000001888E41B940>
There can be only one session active at a time.

Copy link
Contributor

@hiro727 hiro727 left a comment

Choose a reason for hiding this comment

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

lgtm. one small comment

@drewm102 drewm102 merged commit fcf0b5d into main Apr 24, 2024
@drewm102 drewm102 deleted the F376_jlin_dev_0 branch April 24, 2024 22:22
drewm102 pushed a commit that referenced this pull request Jul 31, 2024
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

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载