Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
Jeffrey_Wigger_Master_Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SaCS
Semester-Projects
spring22
Jeffrey_Wigger_Master_Project
Commits
4e3d3d2b
Commit
4e3d3d2b
authored
2 years ago
by
Jeffrey Wigger
Browse files
Options
Downloads
Patches
Plain Diff
this finishes most of the time
parent
b2fe436a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/decentralizepy/communication/TCPRandomWalk.py
+24
-12
24 additions, 12 deletions
src/decentralizepy/communication/TCPRandomWalk.py
with
24 additions
and
12 deletions
src/decentralizepy/communication/TCPRandomWalk.py
+
24
−
12
View file @
4e3d3d2b
...
...
@@ -223,11 +223,11 @@ class TCPRandomWalk(TCPRandomWalkBase):
self
.
send_queue
=
mp
.
Queue
(
1000
)
self
.
recv_queue
=
mp
.
Queue
(
1000
)
# Since we are only adding these do not need to share the same lock, intermediary results may be inconsistent
self
.
lock
=
Lock
()
self
.
total_data
=
Value
(
c_long
,
0
,
lock
=
self
.
lock
)
self
.
total_meta
=
Value
(
c_long
,
0
,
lock
=
self
.
lock
)
self
.
total_bytes
=
Value
(
c_long
,
0
,
lock
=
self
.
lock
)
self
.
flag_running
=
Value
(
c_int
,
0
,
lock
=
False
)
self
.
lock
=
mp
.
Lock
()
self
.
total_data
=
mp
.
Value
(
c_long
,
0
,
lock
=
self
.
lock
)
self
.
total_meta
=
mp
.
Value
(
c_long
,
0
,
lock
=
self
.
lock
)
self
.
total_bytes
=
mp
.
Value
(
c_long
,
0
,
lock
=
self
.
lock
)
self
.
flag_running
=
mp
.
Value
(
c_int
,
0
,
lock
=
False
)
def
connect_neighbors
(
self
,
neighbors
):
"""
...
...
@@ -305,14 +305,14 @@ class TCPRandomWalk(TCPRandomWalkBase):
"""
print
(
"
disconnect_neighbors
"
)
self
.
flag_running
.
value
=
0
del
self
.
lock
self
.
send_queue
.
close
()
# this crashes
self
.
send_queue
.
close
()
# this crashes
self
.
recv_queue
.
close
()
self
.
flag_running
.
value
=
0
#del self.lock
self
.
ctx
.
join
()
print
(
"
disconnect_neighbors: joined
"
)
#
self.
send
_queue.
close() # this crashes
# self.recv_queue.close(
)
self
.
send_queue
.
join_thread
(
)
self
.
recv
_queue
.
join_thread
()
print
(
f
"
disconnect_neighbors: joined
{
self
.
uid
}
"
)
class
TCPRandomWalkInternal
(
TCPRandomWalkBase
):
...
...
@@ -404,9 +404,18 @@ class TCPRandomWalkInternal(TCPRandomWalkBase):
print
(
error_message
)
logging
.
debug
(
"
GOT EXCEPTION
"
)
logging
.
debug
(
error_message
)
while
not
self
.
recv_queue
.
empty
():
print
(
f
"
{
self
.
uid
}
: clear rcv
"
)
_
=
self
.
recv_queue
.
get_nowait
()
self
.
recv_queue
.
close
()
self
.
recv_queue
.
join_thread
()
print
(
f
"
{
self
.
uid
}
: joined recv
"
)
while
not
self
.
send_queue
.
empty
():
print
(
f
"
{
self
.
uid
}
: clear snd
"
)
_
=
self
.
send_queue
.
get_nowait
()
print
(
f
"
{
self
.
uid
}
: joined send
"
)
self
.
send_queue
.
close
()
self
.
send_queue
.
join_thread
()
print
(
"
end
"
)
def
__del__
(
self
):
...
...
@@ -639,6 +648,9 @@ class TCPRandomWalkInternal(TCPRandomWalkBase):
# raise RuntimeError(
# "Received a message when expecting BYE from {}".format(sender)
# )
for
sock
in
self
.
peer_sockets
.
values
():
sock
.
close
()
self
.
router
.
close
()
def
rw_sampler_equi
(
self
,
message
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment