Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 4
0
 def __init__(self,
              config,
              group=None,
              sysinfo_dir=None,
              sysinfo=None,
              label=None):
     self.config = AgentConfig(config)
     if sysinfo == "all":
         sysinfo = ",".join(SYSINFO_OPTS_AVAILABLE)
     if sysinfo == "default":
         sysinfo = ",".join(SYSINFO_OPTS_DEFAULT)
     self.sysinfo = sysinfo
     if sysinfo_dir:
         self.sysinfo_dir = Path(sysinfo_dir)
     self.group = group
     self.label = label
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
def stop(config, debug, group, benchmark_dir):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.process(group, benchmark_dir, get_action(__name__))
Ejemplo n.º 7
0
 def __init__(self, config):
     self.config = AgentConfig(config)
     self.rundir = Path(self.config.rundir)
Ejemplo n.º 8
0
def list(config, debug, name, group, options):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.list(name, group, options)
Ejemplo n.º 9
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)
Ejemplo n.º 10
0
def register(config, debug, group, start_trigger, stop_trigger):
    initialize(AgentConfig(config))
    Trigger(config).register(group, start_trigger, stop_trigger)
Ejemplo n.º 11
0
def list(config, debug, group):
    initialize(AgentConfig(config))
    Trigger(config).list(group)
Ejemplo n.º 12
0
def clear(config, debug, name, group, remote):
    c = AgentConfig(config)
    t = ToolState(c)
    initialize(c)
    t.clear(name, group, remote)