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
561c65a5
"vscode:/vscode.git/clone" did not exist on "3b3bcde0cb0210c9a741b96090a34dde4dc1f0ea"
Commit
561c65a5
authored
Jun 24, 2022
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Jul 08, 2022
Browse files
fixes additional pytype issues
parent
07957f98
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
23 deletions
+25
-23
experiments/simbricks/exectools.py
experiments/simbricks/exectools.py
+2
-0
experiments/simbricks/runtime/common.py
experiments/simbricks/runtime/common.py
+3
-3
experiments/simbricks/simulator_utils.py
experiments/simbricks/simulator_utils.py
+7
-7
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+13
-13
No files found.
experiments/simbricks/exectools.py
View file @
561c65a5
...
...
@@ -186,6 +186,8 @@ class SimpleComponent(Component):
raise
Exception
(
'Command Failed: '
+
str
(
self
.
cmd_parts
))
class
SimpleRemoteComponent
(
SimpleComponent
):
pid_fut
:
asyncio
.
Future
def
__init__
(
self
,
host_name
,
label
,
cmd_parts
,
cwd
=
None
,
ssh_extra_args
=
[],
*
args
,
**
kwargs
):
self
.
host_name
=
host_name
self
.
extra_flags
=
ssh_extra_args
...
...
experiments/simbricks/runtime/common.py
View file @
561c65a5
...
...
@@ -20,10 +20,10 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Allow
type annotation of class to be used in its own constructor
# Allow
own class to be used as type for a method's argument
from
__future__
import
annotations
from
abc
import
abstractmethod
from
abc
import
ABCMeta
,
abstractmethod
import
shutil
import
pathlib
import
typing
as
tp
...
...
@@ -73,7 +73,7 @@ class Run(object):
await
exec
.
mkdir
(
self
.
env
.
shm_base
)
class
Runtime
(
object
):
class
Runtime
(
metaclass
=
ABCMeta
):
"""Base class for managing the execution of multiple runs."""
@
abstractmethod
...
...
experiments/simbricks/simulator_utils.py
View file @
561c65a5
...
...
@@ -33,10 +33,10 @@ def create_basic_hosts(
num
:
int
,
name_prefix
:
str
,
net
:
NetSim
,
nic_class
:
NICSim
,
host_class
:
HostSim
,
nc_class
:
NodeConfig
,
app_class
:
AppConfig
,
nic_class
:
tp
.
Type
[
NICSim
]
,
host_class
:
tp
.
Type
[
HostSim
]
,
nc_class
:
tp
.
Type
[
NodeConfig
]
,
app_class
:
tp
.
Type
[
AppConfig
]
,
ip_start
:
int
=
1
,
ip_prefix
:
int
=
24
):
...
...
@@ -76,9 +76,9 @@ def create_multinic_hosts(
num
:
int
,
name_prefix
:
str
,
net
:
NetSim
,
host_class
:
HostSim
,
nc_class
:
NodeConfig
,
app_class
:
AppConfig
,
host_class
:
tp
.
Type
[
HostSim
]
,
nc_class
:
tp
.
Type
[
NodeConfig
]
,
app_class
:
tp
.
Type
[
AppConfig
]
,
ip_start
:
int
=
1
,
ip_prefix
:
int
=
24
):
...
...
experiments/simbricks/simulators.py
View file @
561c65a5
...
...
@@ -20,6 +20,9 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Allow own class to be used as type for a method's argument
from
__future__
import
annotations
import
math
import
typing
as
tp
...
...
@@ -138,23 +141,20 @@ class NetSim(Simulator):
sync_mode
=
0
sync_period
=
500
eth_latency
=
500
def
__init__
(
self
):
self
.
nics
=
[]
self
.
hosts_direct
=
[]
self
.
net_listen
=
[]
self
.
net_connect
=
[]
super
().
__init__
()
nics
:
list
[
NICSim
]
=
[]
hosts_direct
:
list
[
HostSim
]
=
[]
net_listen
:
list
[
NetSim
]
=
[]
net_connect
:
list
[
NetSim
]
=
[]
def
full_name
(
self
):
return
'net.'
+
self
.
name
def
connect_network
(
self
,
net
):
def
connect_network
(
self
,
net
:
NetSim
):
"""Connect this network to the listening peer `net`"""
net
.
net_listen
.
append
(
self
)
self
.
net_connect
.
append
(
net
)
def
connect_sockets
(
self
,
env
):
def
connect_sockets
(
self
,
env
:
ExpEnv
):
sockets
=
[]
for
n
in
self
.
nics
:
sockets
.
append
((
n
,
env
.
nic_eth_path
(
n
)))
...
...
@@ -164,7 +164,7 @@ class NetSim(Simulator):
sockets
.
append
((
h
,
env
.
net2host_eth_path
(
self
,
h
)))
return
sockets
def
listen_sockets
(
self
,
env
):
def
listen_sockets
(
self
,
env
:
ExpEnv
):
listens
=
[]
for
net
in
self
.
net_listen
:
listens
.
append
((
net
,
env
.
n2n_eth_path
(
self
,
net
)))
...
...
@@ -173,10 +173,10 @@ class NetSim(Simulator):
def
dependencies
(
self
):
return
self
.
nics
+
self
.
net_connect
+
self
.
hosts_direct
def
sockets_cleanup
(
self
,
env
):
def
sockets_cleanup
(
self
,
env
:
ExpEnv
):
return
[
s
for
(
_
,
s
)
in
self
.
listen_sockets
(
env
)]
def
sockets_wait
(
self
,
env
):
def
sockets_wait
(
self
,
env
:
ExpEnv
):
return
[
s
for
(
_
,
s
)
in
self
.
listen_sockets
(
env
)]
...
...
@@ -419,7 +419,7 @@ class MultiSubNIC(NICSim):
def
start_delay
(
self
):
return
0
class
I40eMultiNIC
(
Simulator
):
class
I40eMultiNIC
(
Simulator
):
# TODO Fix typing, e.g., by making this a sublcass of NICSim
name
=
''
def
__init__
(
self
):
...
...
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