Exemple #1
0
    def start_dfuse(self, pool):
        """Create dfuse start command line for slurm.

        Args:
            pool (obj):             TestPool obj

        Returns dfuse(obj):         Dfuse obj
                cmd(list):          list of dfuse commands to add to jobscript
        """
        commands = []
        # Get Dfuse params
        dfuse = Dfuse(self.hostlist_clients, self.tmp)
        dfuse.get_params(self)
        # update dfuse params; mountpoint for each container
        unique = get_random_string(5, self.used)
        self.used.append(unique)
        mount_dir = dfuse.mount_dir.value + unique
        dfuse.mount_dir.update(mount_dir)
        dfuse.set_dfuse_params(pool)
        dfuse.set_dfuse_cont_param(self.create_dfuse_cont(pool))
        # create dfuse mount point
        commands.append(slurm_utils.srun_str(
            hosts=None,
            cmd="mkdir -p {}".format(dfuse.mount_dir.value),
            srun_params=None))
        commands.append(slurm_utils.srun_str(
            hosts=None,
            cmd="{}".format(dfuse.__str__()),
            srun_params=None))
        commands.append("sleep 10")
        commands.append(slurm_utils.srun_str(
            hosts=None,
            cmd="df -h {}".format(dfuse.mount_dir.value),
            srun_params=None))
        return dfuse, commands
Exemple #2
0
    def create_fio_cmdline(self, job_spec, pool):
        """Create the FOI commandline for job script.

        Args:

            job_spec (str): fio job in yaml to run
            pool (obj):   TestPool obj
            ppn(int): number of tasks to run on each node

        Returns:
            cmd(list): list of cmdlines

        """
        commands = []
        fio_namespace = "/run/{}".format(job_spec)
        # test params
        bs_list = self.params.get("blocksize", fio_namespace + "/soak/*")
        size_list = self.params.get("size", fio_namespace + "/soak/*")
        rw_list = self.params.get("rw", fio_namespace + "/soak/*")
        # Get the parameters for Fio
        fio_cmd = FioCommand()
        fio_cmd.namespace = "{}/*".format(fio_namespace)
        fio_cmd.get_params(self)
        for blocksize in bs_list:
            for size in size_list:
                for rw in rw_list:
                    # update fio params
                    fio_cmd.update("global", "blocksize", blocksize,
                                   "fio --name=global --blocksize")
                    fio_cmd.update("global", "size", size,
                                   "fio --name=global --size")
                    fio_cmd.update("global", "rw", rw,
                                   "fio --name=global --rw")
                    srun_cmds = []

                    # add srun start dfuse cmds if api is POSIX
                    if fio_cmd.api.value == "POSIX":
                        # Connect to the pool, create container
                        # and then start dfuse
                        dfuse, srun_cmds = self.start_dfuse(pool)
                    # Update the FIO cmdline
                    fio_cmd.update("global", "directory",
                                   dfuse.mount_dir.value,
                                   "fio --name=global --directory")
                    # add srun and srun params to fio cmline
                    srun_cmds.append(
                        slurm_utils.srun_str(hosts=None,
                                             cmd=str(fio_cmd.__str__()),
                                             srun_params=None))
                    # If posix, add the srun dfuse stop cmds
                    if fio_cmd.api.value == "POSIX":
                        srun_cmds.extend(self.stop_dfuse(dfuse))

                    log_name = "{}_{}_{}".format(blocksize, size, rw)
                    commands.append([srun_cmds, log_name])
                    self.log.info("<<Fio cmdlines>>:")
                    for cmd in srun_cmds:
                        self.log.info("%s", cmd)
        return commands
Exemple #3
0
    def stop_dfuse(self, dfuse):
        """Create dfuse stop command line for slurm.

        Args:
            dfuse (obj): Dfuse obj

        Returns list:    list of cmds to pass to slurm script
        """
        self.log.info("\n")
        dfuse_stop_cmds = [slurm_utils.srun_str(
            hosts=None,
            cmd="fusermount3 -u {0}".format(dfuse.mount_dir.value),
            srun_params=None)]
        dfuse_stop_cmds.append(slurm_utils.srun_str(
            hosts=None,
            cmd="rm -rf {0}".format(dfuse.mount_dir.value),
            srun_params=None))
        return dfuse_stop_cmds