Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
i4
manycore
emper-io-eval
Commits
632d6037
Commit
632d6037
authored
Jan 21, 2022
by
Florian Fischer
Browse files
capture coordinator output
parent
7fce7052
Changes
2
Show whitespace changes
Inline
Side-by-side
bench/client.py
View file @
632d6037
...
@@ -124,7 +124,10 @@ def run_remote_clients(cmd: str, out: Path, err: Path, csv: Path,
...
@@ -124,7 +124,10 @@ def run_remote_clients(cmd: str, out: Path, err: Path, csv: Path,
files
=
[]
files
=
[]
# Start coordinator
# Start coordinator
coordinator
=
Coordinator
(
len
(
hosts
))
c_out
=
out
.
parent
/
f
'coordinator-
{
out
.
name
}
'
c_err
=
err
.
parent
/
f
'coordinator-
{
err
.
name
}
'
coordinator
=
Coordinator
(
len
(
hosts
),
out_file
=
c_out
,
err_file
=
c_err
)
cmd
+=
f
' --coordinator
{
HOSTNAME
}
'
cmd
+=
f
' --coordinator
{
HOSTNAME
}
'
for
host
in
hosts
:
for
host
in
hosts
:
...
...
bench/coordinator.py
View file @
632d6037
...
@@ -12,12 +12,19 @@ COORDINATOR_EXE = f'{EMPER_CLIENT_DIR}/build/apps/coordinator'
...
@@ -12,12 +12,19 @@ COORDINATOR_EXE = f'{EMPER_CLIENT_DIR}/build/apps/coordinator'
class
Coordinator
(
subprocess
.
Popen
):
class
Coordinator
(
subprocess
.
Popen
):
"""Coordniator class usable in a with statement"""
"""Coordniator class usable in a with statement"""
def
__init__
(
self
,
nclients
):
def
__init__
(
self
,
nclients
,
out_file
=
None
,
err_file
=
None
):
self
.
fout
=
subprocess
.
DEVNULL
self
.
ferr
=
subprocess
.
DEVNULL
if
out_file
:
self
.
fout
=
open
(
out_file
,
'w'
)
if
err_file
:
self
.
ferr
=
open
(
err_file
,
'w'
)
cmd
=
f
'
{
COORDINATOR_EXE
}
{
nclients
}
'
cmd
=
f
'
{
COORDINATOR_EXE
}
{
nclients
}
'
log
.
debug
(
'Creating coordinator object with cmd: %s'
,
cmd
)
log
.
debug
(
'Creating coordinator object with cmd: %s'
,
cmd
)
super
().
__init__
(
cmd
.
split
(),
super
().
__init__
(
cmd
.
split
(),
stdout
=
s
ubprocess
.
DEVNULL
,
stdout
=
s
elf
.
fout
,
stderr
=
s
ubprocess
.
DEVNULL
)
stderr
=
s
elf
.
ferr
)
def
__enter__
(
self
):
def
__enter__
(
self
):
log
.
debug
(
'Start coordinator'
)
log
.
debug
(
'Start coordinator'
)
...
@@ -26,3 +33,9 @@ class Coordinator(subprocess.Popen):
...
@@ -26,3 +33,9 @@ class Coordinator(subprocess.Popen):
def
__exit__
(
self
,
exc_type
,
value
,
traceback
):
# pylint: disable=arguments-differ
def
__exit__
(
self
,
exc_type
,
value
,
traceback
):
# pylint: disable=arguments-differ
log
.
debug
(
'Join coordinator'
)
log
.
debug
(
'Join coordinator'
)
super
().
__exit__
(
exc_type
,
value
,
traceback
)
super
().
__exit__
(
exc_type
,
value
,
traceback
)
def
__del__
(
self
):
if
self
.
fout
!=
subprocess
.
DEVNULL
:
self
.
fout
.
close
()
if
self
.
ferr
!=
subprocess
.
DEVNULL
:
self
.
ferr
.
close
()
Write
Preview
Supports
Markdown
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