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
fba7164d
"tests/data/vscode:/vscode.git/clone" did not exist on "6356cbdc4f652aa6004b08b0fc05f6a4ec9d0b97"
Commit
fba7164d
authored
Jan 15, 2024
by
Antoine Kaufmann
Committed by
Antoine Kaufmann
May 08, 2024
Browse files
experiments: use exceptions instead of sys.exit in e2e_components
parent
f82b5198
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
experiments/simbricks/orchestration/e2e_components.py
experiments/simbricks/orchestration/e2e_components.py
+11
-15
No files found.
experiments/simbricks/orchestration/e2e_components.py
View file @
fba7164d
...
...
@@ -27,8 +27,6 @@ import typing as tp
from
abc
import
ABC
,
abstractmethod
from
enum
import
Enum
import
sys
class
CongestionControl
(
Enum
):
RENO
=
(
"ns3::TcpLinuxReno"
,
"reno"
)
...
...
@@ -59,8 +57,8 @@ class CongestionControl(Enum):
@
property
def
ns3
(
self
):
if
self
.
ns3_str
==
""
:
print
(
f
"There is no ns3 implementation for
{
self
.
name
}
available"
)
sys
.
exit
(
1
)
raise
AttributeError
(
f
"There is no ns3 implementation for
"
f
"
{
self
.
name
}
available"
)
return
self
.
ns3_str
@
property
...
...
@@ -118,8 +116,7 @@ class E2EGlobalConfig(E2EBase):
return
super
().
ns3_config
()
def
add_component
(
self
,
component
:
E2EComponent
)
->
None
:
print
(
"Can't add a component to the global config"
)
sys
.
exit
(
1
)
raise
AttributeError
(
"Can't add a component to the global config"
)
class
E2EComponent
(
E2EBase
):
...
...
@@ -132,8 +129,7 @@ class E2EComponent(E2EBase):
def
ns3_config
(
self
)
->
str
:
if
self
.
id
==
""
or
self
.
type
==
""
:
print
(
"Id or Type cannot be empty"
)
sys
.
exit
(
1
)
raise
AttributeError
(
"Id or Type cannot be empty"
)
self
.
mapping
.
update
({
"Id"
:
self
.
id
,
"Type"
:
self
.
type
})
return
super
().
ns3_config
()
...
...
@@ -144,13 +140,14 @@ class E2EComponent(E2EBase):
def
resolve_paths
(
self
)
->
None
:
self
.
has_path
=
True
for
component
in
self
.
components
:
path
=
f
"
{
self
.
id
}
/
{
component
.
id
}
"
if
component
.
has_path
:
print
(
f
"Component
{
component
.
id
}
was already "
+
"added to another component"
raise
AttributeError
(
f
"Component
{
component
.
id
}
was already "
f
"added to another component (while trying "
f
"to assign
{
path
}
)."
)
sys
.
exit
(
1
)
component
.
id
=
f
"
{
self
.
id
}
/
{
component
.
id
}
"
component
.
id
=
path
component
.
resolve_paths
()
...
...
@@ -196,8 +193,7 @@ class E2ESimpleChannel(E2ETopologyChannel):
def
ns3_config
(
self
)
->
str
:
if
self
.
left_node
is
None
or
self
.
right_node
is
None
:
print
(
f
"Not all nodes for channel
{
self
.
id
}
given"
)
sys
.
exit
(
1
)
raise
AttributeError
(
f
"Not all nodes for channel
{
self
.
id
}
given"
)
self
.
mapping
.
update
({
"DataRate"
:
self
.
data_rate
,
"QueueSize"
:
self
.
queue_size
,
...
...
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