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 request spelling error and add socket resource release #1165

Closed

Conversation

yangrudan
Copy link

What changes were proposed in this pull request?

  1. Correct request word spelling error;
  2. Add socket close in communication to avoid resource leaks.

Why are the changes needed?

  1. To avoid resource leaks;
  2. Add exception handling in communication.

Does this PR introduce any user-facing change?

No feeling.

How was this patch tested?

Run unit test in dlrover/trainer/tests/torch/*_test.py.

@yangrudan yangrudan marked this pull request as draft June 21, 2024 08:53
@yangrudan yangrudan marked this pull request as ready for review June 21, 2024 08:54
@@ -242,26 +249,35 @@ def __init__(self, name="", create=False):
else:
self._lock = None

def deal_client_msg(self, connection):
Copy link
Collaborator

Choose a reason for hiding this comment

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

deal_client_msg -> _deal_client_msg which is a private method.

@@ -471,28 +497,38 @@ def __init__(self, name="", create=False):
name=f"shard_dict_{name}", create=self._create
)

def deal_client_msg(self, connection):
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are 3 methods with the same name deal_client_msg. We can rename them as
_deal_shared_lock_msg
_deal_shared_queue_msg
_deal_shared_dict_msg

Copy link
Author

Choose a reason for hiding this comment

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

ok

try:
self.deal_client_msg(connection)
finally:
# 确保连接被关闭
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use English annotations.

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 76.08696% with 22 lines in your changes missing coverage. Please review.

Project coverage is 79.61%. Comparing base (7f05d90) to head (8575bc9).

Current head 8575bc9 differs from pull request most recent head ae2de56

Please upload reports for the commit ae2de56 to get more accurate results.

Files Patch % Lines
dlrover/python/common/multi_process.py 76.08% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1165      +/-   ##
==========================================
- Coverage   79.61%   79.61%   -0.01%     
==========================================
  Files         210      210              
  Lines       18644    18672      +28     
==========================================
+ Hits        14844    14866      +22     
- Misses       3800     3806       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@workingloong
Copy link
Collaborator

You need to run pre-commit to check the code style before submitting a PR by the tutorial. https://github.com/intelligent-machine-learning/dlrover/blob/master/docs/developer_guide.md#submit-a-pr

@yangrudan yangrudan closed this Jun 25, 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.

None yet

2 participants