Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
816b1893
Commit
816b1893
authored
Aug 06, 2021
by
Antoine Kaufmann
Browse files
experiments: proper cleanup of sockets created by proxy
parent
c01c0877
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
experiments/simbricks/experiments.py
experiments/simbricks/experiments.py
+20
-5
No files found.
experiments/simbricks/experiments.py
View file @
816b1893
...
@@ -24,6 +24,7 @@ import os
...
@@ -24,6 +24,7 @@ import os
import
asyncio
import
asyncio
from
collections
import
defaultdict
from
collections
import
defaultdict
import
simbricks.exectools
as
exectools
import
simbricks.exectools
as
exectools
import
simbricks.proxy
import
shlex
import
shlex
import
time
import
time
import
itertools
import
itertools
...
@@ -328,6 +329,18 @@ class ExperimentDistributedRunner(ExperimentBaseRunner):
...
@@ -328,6 +329,18 @@ class ExperimentDistributedRunner(ExperimentBaseRunner):
await
super
().
prepare
()
await
super
().
prepare
()
def
add_proxy_sockets
(
self
,
exec
,
proxy
):
# add shared memory region for proxy
self
.
sockets
.
append
((
exec
,
self
.
env
.
proxy_shm_path
(
proxy
)))
# add each listening unix socket
for
(
nic
,
local
)
in
proxy
.
nics
:
add
=
False
if
(
isinstance
(
proxy
,
simbricks
.
proxy
.
NetProxyConnecter
)
and
local
)
\
or
(
isinstance
(
proxy
,
simbricks
.
proxy
.
NetProxyListener
)
\
and
not
local
):
self
.
sockets
.
append
((
exec
,
self
.
env
.
nic_eth_path
(
nic
)))
async
def
run_proxies_listeners
(
self
):
async
def
run_proxies_listeners
(
self
):
""" Start all listening proxies. """
""" Start all listening proxies. """
if
self
.
verbose
:
if
self
.
verbose
:
...
@@ -341,9 +354,10 @@ class ExperimentDistributedRunner(ExperimentBaseRunner):
...
@@ -341,9 +354,10 @@ class ExperimentDistributedRunner(ExperimentBaseRunner):
shlex
.
split
(
proxy
.
run_cmd
(
self
.
env
)),
verbose
=
self
.
verbose
,
shlex
.
split
(
proxy
.
run_cmd
(
self
.
env
)),
verbose
=
self
.
verbose
,
canfail
=
True
)
canfail
=
True
)
await
sc
.
start
()
await
sc
.
start
()
self
.
running
.
append
((
proxy
,
sc
))
await
asyncio
.
sleep
(
0.5
)
self
.
running
.
append
((
proxy
,
sc
))
self
.
add_proxy_sockets
(
exec
,
proxy
)
await
asyncio
.
sleep
(
10
)
async
def
run_proxies_connecters
(
self
):
async
def
run_proxies_connecters
(
self
):
""" Start all connecting proxies. """
""" Start all connecting proxies. """
...
@@ -358,9 +372,10 @@ class ExperimentDistributedRunner(ExperimentBaseRunner):
...
@@ -358,9 +372,10 @@ class ExperimentDistributedRunner(ExperimentBaseRunner):
shlex
.
split
(
proxy
.
run_cmd
(
self
.
env
)),
verbose
=
self
.
verbose
,
shlex
.
split
(
proxy
.
run_cmd
(
self
.
env
)),
verbose
=
self
.
verbose
,
canfail
=
True
)
canfail
=
True
)
await
sc
.
start
()
await
sc
.
start
()
self
.
running
.
append
((
proxy
,
sc
))
await
asyncio
.
sleep
(
0.5
)
self
.
running
.
append
((
proxy
,
sc
))
self
.
add_proxy_sockets
(
exec
,
proxy
)
await
asyncio
.
sleep
(
10
)
async
def
wait_proxy_sockets
(
self
):
async
def
wait_proxy_sockets
(
self
):
# TODO
# TODO
...
@@ -443,4 +458,4 @@ class ExpOutput(object):
...
@@ -443,4 +458,4 @@ class ExpOutput(object):
self
.
sims
[
sim
.
full_name
()]
=
obj
self
.
sims
[
sim
.
full_name
()]
=
obj
def
dumps
(
self
):
def
dumps
(
self
):
return
json
.
dumps
(
self
.
__dict__
)
return
json
.
dumps
(
self
.
__dict__
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment