コード例 #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)
コード例 #2
0
ファイル: config.py プロジェクト: zulcss/pbench-lite
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)
コード例 #3
0
ファイル: config.py プロジェクト: zulcss/pbench-lite
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)
コード例 #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)
コード例 #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__))
コード例 #6
0
def list(config, debug, name, group, options):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.list(name, group, options)
コード例 #7
0
ファイル: register.py プロジェクト: zulcss/pbench-lite
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)
コード例 #8
0
ファイル: triggers.py プロジェクト: zulcss/pbench-lite
def register(config, debug, group, start_trigger, stop_trigger):
    initialize(AgentConfig(config))
    Trigger(config).register(group, start_trigger, stop_trigger)
コード例 #9
0
ファイル: triggers.py プロジェクト: zulcss/pbench-lite
def list(config, debug, group):
    initialize(AgentConfig(config))
    Trigger(config).list(group)
コード例 #10
0
def clear(config, debug, name, group, remote):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.clear(name, group, remote)