-
Notifications
You must be signed in to change notification settings - Fork 23
feat(server): expose the server debug trace functionality #2650
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
Open
PProfizi
wants to merge
5
commits into
main
Choose a base branch
from
feat/debug_server_trace
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ba09401
Create in ansys.dpf.core.debug
PProfizi 654e0ec
Switch to BaseServer.start_debug and BaseServer.stop_debug
PProfizi f5e9ff8
Adapt path to server os
PProfizi 9d14f3f
Add a DEFAULT_SERVER_DEBUG global variable
PProfizi 414a4ed
Add a test
PProfizi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,7 @@ | |
|
||
SERVER = None | ||
SERVER_CONFIGURATION = None | ||
DEFAULT_SERVER_DEBUG = None | ||
|
||
_server_instances = [] | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,20 @@ def test_server_plugins(self, server_config): | |
assert isinstance(server_plugins, dict) | ||
assert "native" in server_plugins.keys() | ||
|
||
def test_server_debug(self, server_config, tmp_path): | ||
from pathlib import Path | ||
|
||
server_instance = start_local_server(config=server_config) | ||
server_instance.start_debug(tmp_path / Path("DEBUG_TEST_")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You miss a "/" or "" at the end |
||
f = dpf.core.field_from_array([1.0], server=server_instance) | ||
fwd = dpf.core.operators.utility.forward(any=f, server=server_instance) | ||
fwd.run() | ||
server_instance.stop_debug() | ||
debug_folder = sorted(tmp_path.glob("DEBUG_TEST_*")) | ||
assert len(debug_folder) == 1 | ||
init_path = debug_folder[0] / Path("init.log") | ||
assert init_path.exists() | ||
|
||
|
||
@pytest.mark.skipif( | ||
os.name == "posix" or running_docker, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it really be at the server API? Wouldn't it be better in core, close to load plugin...
Also, I would create a context manager (similar design to licensing context manager)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'll put tests but I wanted to validate the API first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it at the Server level because it is a specific server you ask for its debug info.
I can make a context manager and also expose it at the ansys.dpf.core level as a global command which would take the global server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense here, as it is for a given server.
Just a question, I remember we had an issue in the past that was fixed for data sources when the client was in a OS (say Windows) and the server was another (say Linux), that there was some path adaptation. I think that was fixed. Is this affected by that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you are right, I am now adding the same logic here.