Commit d87426c8 authored by Florian Fischer's avatar Florian Fischer
Browse files

also purge empty coordinator files

parent 10a5689f
......@@ -2,7 +2,6 @@
"""Echoclient related code"""
import logging
import os
from pathlib import Path
import pprint as pp
import subprocess
......@@ -11,7 +10,7 @@ from typing import Mapping, Sequence, Union
from .benchresult import BenchResult
from .coordinator import Coordinator
from .globalvars import EMPER_CLIENT_DIR, CLIENTS_DIR, HOSTNAME, KILL_CMD, TERMINATION_TIME
from .util import cmd_run, prepare_env
from .util import cmd_run, prepare_env, purge_empty_files
log = logging.getLogger(__name__)
......@@ -30,13 +29,6 @@ CLIENT_DEFAULT_TERMINATION = ('time', 60)
CLIENT_CMD = '{exe} -c {cons} -s {size} {termination_flag} -a {host} -f {outfile} --no-quit'
def purge_empty_files(files: Sequence[Union[str, Path]]):
"""Remove empty files"""
for _file in files:
if os.path.exists(_file) and os.stat(_file).st_size == 0:
os.remove(_file)
def run_clients(run: int,
args: Mapping,
result_dir,
......@@ -128,6 +120,7 @@ def run_remote_clients(cmd: str, out: Path, err: Path, csv: Path,
# Start coordinator
c_out = out.parent / f'coordinator-{out.name}'
c_err = err.parent / f'coordinator-{err.name}'
files.extend([c_out, c_err])
coordinator = Coordinator(len(hosts), out_file=c_out, err_file=c_err)
cmd += f' --coordinator {HOSTNAME}'
......
......@@ -4,7 +4,8 @@
import logging
import os
import subprocess
from typing import Dict, MutableMapping
from pathlib import Path
from typing import Dict, MutableMapping, Sequence, Union
def prepare_env(update_env: MutableMapping) -> Dict:
......@@ -35,3 +36,10 @@ def cmd_run(cmd: str, log: logging.Logger, cwd=None, env=None, check=True):
log.critical('subcommand failed: %s', run_err)
log.debug('%s', run_err.stderr)
raise run_err
def purge_empty_files(files: Sequence[Union[str, Path]]):
"""Remove empty files"""
for _file in files:
if os.path.exists(_file) and os.stat(_file).st_size == 0:
os.remove(_file)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment