Beispiel #1
0
def cleanup(config, debug):
    c = AgentConfig(config)
    try:
        initialize(c)
        (result, errors) = rmtree(c.rundir)
        if not result:
            logger.error("\n".join(errors))
        sys.exit(result)
    except Exception as ex:
        logger.error("Failed to remove %s: %s", c.rundir, ex)
        sys.exit(1)
Beispiel #2
0
def ssh(debug, config, keyfile):
    c = AgentConfig(config)
    initialize(c)
    src = pathlib.Path(keyfile)
    dest = pathlib.Path(c.installdir, "id_rsa")

    if not dest.exists():
        try:
            shutil.copyfile(src, dest)
        except Exception as ex:
            logger.error("Failed to copy ssh key file %s: %s", src, ex)
            sys.exit(1)
Beispiel #3
0
def activate(debug, config):
    c = AgentConfig(config)
    initialize(c)
    src = pathlib.Path(config)
    dest = pathlib.Path(c.installdir, "config", "pbench-agent.cfg")

    if not dest.exists():
        try:
            shutil.copyfile(src, dest)
        except Exception as ex:
            logger.error("Failed to copy %s: %s", src, ex)
            sys.exit(1)
Beispiel #4
0
def clear(config, debug):
    c = AgentConfig(config)
    initialize(c)
    rundir = pathlib.Path(c.rundir)

    if rundir.exists():
        for path in rundir.glob("*"):
            if not (path.name.startswith("tmp")
                    or path.name.startswith("tools")
                    or path.name == "pbench.log"):
                if path.is_file():
                    try:
                        os.unlink(path)
                    except Exception as ex:
                        logger.error("Failed to remove %s: %s", path, ex)
                if path.is_dir():
                    try:
                        shutil.rmtree(path)
                    except Exception as ex:
                        logger.error("Failed to remove %s: %s", path, ex)
Beispiel #5
0
def stop(config, debug, group, benchmark_dir):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.process(group, benchmark_dir, get_action(__name__))
Beispiel #6
0
def list(config, debug, name, group, options):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.list(name, group, options)
Beispiel #7
0
def register(config, debug, name, group, no_install, remotes, labels, args):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.register(name, group, no_install, remotes, labels, args)
Beispiel #8
0
def register(config, debug, group, start_trigger, stop_trigger):
    initialize(AgentConfig(config))
    Trigger(config).register(group, start_trigger, stop_trigger)
Beispiel #9
0
def list(config, debug, group):
    initialize(AgentConfig(config))
    Trigger(config).list(group)
Beispiel #10
0
def clear(config, debug, name, group, remote):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.clear(name, group, remote)