def setUp(self): """Set up each test case.""" # obtain separate logs self.update_log_file_names() # Start the servers and agents super().setUp() # Get the parameters for Fio self.fio_cmd = FioCommand() self.fio_cmd.get_params(self) self.processes = self.params.get("np", '/run/fio/client_processes/*') self.manager = self.params.get("manager", '/run/fio/*', "MPICH")
class FioBase(DfuseTestBase): # pylint: disable=too-many-ancestors """Base fio class. :avocado: recursive """ def __init__(self, *args, **kwargs): """Initialize a FioBase object.""" super(FioBase, self).__init__(*args, **kwargs) self.fio_cmd = None self.processes = None self.manager = None def setUp(self): """Set up each test case.""" # obtain separate logs self.update_log_file_names() # Start the servers and agents super(FioBase, self).setUp() # Get the parameters for Fio self.fio_cmd = FioCommand() self.fio_cmd.get_params(self) self.processes = self.params.get("np", '/run/fio/client_processes/*') self.manager = self.params.get("manager", '/run/fio/*', "MPICH") def execute_fio(self, directory=None, stop_dfuse=True): """Runner method for Fio. Args: directory (str): path for fio run dir stop_dfuse (bool): Flag to stop or not stop dfuse as part of this method. """ # Create a pool if one does not already exist if self.pool is None: self.add_pool(connect=False) # start dfuse if api is POSIX if self.fio_cmd.api.value == "POSIX": if directory: self.fio_cmd.update( "global", "directory", directory, "fio --name=global --directory") else: self.add_container(self.pool) self.start_dfuse( self.hostlist_clients, self.pool, self.container) self.fio_cmd.update( "global", "directory", self.dfuse.mount_dir.value, "fio --name=global --directory") # Run Fio self.fio_cmd.hosts = self.hostlist_clients self.fio_cmd.run() if stop_dfuse: self.stop_dfuse()
def setUp(self): """Set up each test case.""" # obtain separate logs self.update_log_file_names() # Start the servers and agents super(FioBase, self).setUp() # removing runner node from hostlist_client, only need one client node. self.hostlist_clients = self.hostlist_clients[:-1] # Get the parameters for Fio self.fio_cmd = FioCommand() self.fio_cmd.get_params(self) self.processes = self.params.get("np", '/run/fio/client_processes/*') self.manager = self.params.get("manager", '/run/fio/*', "MPICH")
class FioBase(TestWithServers): """Base fio class. :avocado: recursive """ def __init__(self, *args, **kwargs): """Initialize a FioBase object.""" super(FioBase, self).__init__(*args, **kwargs) self.fio_cmd = None self.processes = None self.manager = None self.dfuse = None self.daos_cmd = None def setUp(self): """Set up each test case.""" # obtain separate logs self.update_log_file_names() # Start the servers and agents super(FioBase, self).setUp() # initialise daos_cmd self.daos_cmd = DaosCommand(self.bin) # Get the parameters for Fio self.fio_cmd = FioCommand() self.fio_cmd.get_params(self) self.processes = self.params.get("np", '/run/fio/client_processes/*') self.manager = self.params.get("manager", '/run/fio/*', "MPICH") def tearDown(self): """Tear down each test case.""" try: if self.dfuse: self.dfuse.stop() finally: # Stop the servers and agents super(FioBase, self).tearDown() def _create_pool(self): """Create a pool and execute Fio.""" # Get the pool params # pylint: disable=attribute-defined-outside-init self.pool = TestPool(self.context, dmg_command=self.get_dmg_command()) self.pool.get_params(self) # Create a pool self.pool.create() def _create_cont(self): """Create a container. Returns: str: UUID of the created container """ cont_type = self.params.get("type", "/run/container/*") result = self.daos_cmd.container_create(pool=self.pool.uuid, svc=self.pool.svc_ranks, cont_type=cont_type) # Extract the container UUID from the daos container create output cont_uuid = re.findall(r"created\s+container\s+([0-9a-f-]+)", result.stdout) if not cont_uuid: self.fail("Error obtaining the container uuid from: {}".format( result.stdout)) return cont_uuid[0] def _start_dfuse(self): """Create a DfuseCommand object to start dfuse.""" # Get Dfuse params self.dfuse = Dfuse(self.hostlist_clients, self.tmp) self.dfuse.get_params(self) # update dfuse params self.dfuse.set_dfuse_params(self.pool) self.dfuse.set_dfuse_cont_param(self._create_cont()) self.dfuse.set_dfuse_exports(self.server_managers[0], self.client_log) try: # start dfuse self.dfuse.run() except CommandFailure as error: self.log.error("Dfuse command %s failed on hosts %s", str(self.dfuse), str(NodeSet.fromlist(self.dfuse.hosts)), exc_info=error) self.fail("Unable to launch Dfuse.\n") def execute_fio(self): """Runner method for Fio.""" # Create a pool if one does not already exist if self.pool is None: self._create_pool() # start dfuse if api is POSIX if self.fio_cmd.api.value == "POSIX": # Connect to the pool, create container and then start dfuse # Uncomment below two lines once DAOS-3355 is resolved # self.pool.connect() # self.create_cont() self._start_dfuse() self.fio_cmd.update("global", "directory", self.dfuse.mount_dir.value, "fio --name=global --directory") # Run Fio self.fio_cmd.hosts = self.hostlist_clients self.fio_cmd.run() if self.dfuse: self.dfuse.stop() self.dfuse = None
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
def create_fio_cmdline(self, job_spec, pool): """Create the FOI commandline. 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") # start dfuse if api is POSIX if fio_cmd.api.value == "POSIX": # Connect to the pool, create container # and then start dfuse self.start_dfuse(pool) fio_cmd.update("global", "directory", self.dfuse.mount_dir.value, "fio --name=global --directory") # fio command log_name = "{}_{}_{}".format(blocksize, size, rw) commands.append([fio_cmd.__str__(), log_name]) self.log.info("<<FIO cmdline>>: %s \n", commands[-1]) return commands
def create_fio_cmdline(self, job_spec, pool): """Create the FOI commandline for job script. Args: self (obj): soak obj 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 = os.path.join(os.sep, "run", job_spec, "*") fio_soak_namespace = os.path.join(os.sep, "run", job_spec, "soak", "*") # test params bs_list = self.params.get("blocksize", fio_soak_namespace) size_list = self.params.get("size", fio_soak_namespace) rw_list = self.params.get("rw", fio_soak_namespace) oclass_list = self.params.get("oclass", fio_soak_namespace) # Get the parameters for Fio fio_cmd = FioCommand() fio_cmd.namespace = fio_namespace fio_cmd.get_params(self) fio_cmd.aux_path.update(self.test_dir, "aux_path") for blocksize in bs_list: for size in size_list: for rw in rw_list: for o_type in oclass_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 add_containers(self, pool, o_type) daos_cmd = DaosCommand(self.bin) daos_cmd.container_set_attr(pool.uuid, self.container[-1].uuid, 'dfuse-direct-io-disable', 'on') log_name = "{}_{}_{}_{}_{}".format( job_spec, blocksize, size, rw, o_type) dfuse, srun_cmds = start_dfuse(self, pool, self.container[-1], nodesperjob=1, name=log_name, job_spec=job_spec) # Update the FIO cmdline fio_cmd.update("global", "directory", dfuse.mount_dir.value, "fio --name=global --directory") # add fio cmline srun_cmds.append(str(fio_cmd.__str__())) srun_cmds.append("status=$?") # If posix, add the srun dfuse stop cmds if fio_cmd.api.value == "POSIX": srun_cmds.extend(stop_dfuse(dfuse, nodesperjob=1)) commands.append([srun_cmds, log_name]) self.log.info("<<Fio cmdlines>>:") for cmd in srun_cmds: self.log.info("%s", cmd) return commands
class FioBase(TestWithServers): """Base fio class. :avocado: recursive """ def __init__(self, *args, **kwargs): """Initialize a FioBase object.""" super(FioBase, self).__init__(*args, **kwargs) self.fio_cmd = None self.processes = None self.manager = None self.dfuse = None def setUp(self): """Set up each test case.""" # obtain separate logs self.update_log_file_names() # Start the servers and agents super(FioBase, self).setUp() # removing runner node from hostlist_client, only need one client node. self.hostlist_clients = self.hostlist_clients[:-1] # Get the parameters for Fio self.fio_cmd = FioCommand() self.fio_cmd.get_params(self) self.processes = self.params.get("np", '/run/fio/client_processes/*') self.manager = self.params.get("manager", '/run/fio/*', "MPICH") def tearDown(self): """Tear down each test case.""" try: self.dfuse = None finally: # Stop the servers and agents super(FioBase, self).tearDown() def _create_pool(self): """Create a pool and execute Fio.""" # Get the pool params # pylint: disable=attribute-defined-outside-init self.pool = TestPool(self.context, dmg_command=self.get_dmg_command()) self.pool.get_params(self) # Create a pool self.pool.create() def _create_cont(self): """Create a TestContainer object to be used to create container.""" # TO-DO: Enable container using TestContainer object, # once DAOS-3355 is resolved. # Get Container params # self.container = TestContainer(self.pool) # self.container.get_params(self) # create container # self.container.create() env = Dfuse(self.hostlist_clients, self.tmp).get_default_env() # command to create container of posix type cmd = env + "daos cont create --pool={} --svc={} --type=POSIX".format( self.pool.uuid, ":".join( [str(item) for item in self.pool.svc_ranks])) try: container = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) (output, err) = container.communicate() self.log.info("Container created with UUID %s", output.split()[3]) except subprocess.CalledProcessError as err: self.fail("Container create failed:{}".format(err)) return output.split()[3] def _start_dfuse(self): """Create a DfuseCommand object to start dfuse.""" # Get Dfuse params self.dfuse = Dfuse(self.hostlist_clients, self.tmp, self.basepath) self.dfuse.get_params(self) # update dfuse params self.dfuse.set_dfuse_params(self.pool) self.dfuse.set_dfuse_cont_param(self._create_cont()) try: # start dfuse self.dfuse.run() except CommandFailure as error: self.log.error("Dfuse command %s failed on hosts %s", str(self.dfuse), str( NodeSet.fromlist(self.dfuse.hosts)), exc_info=error) self.fail("Unable to launch Dfuse.\n") def execute_fio(self): """Runner method for Fio.""" # Create a pool if one does not already exist if self.pool is None: self._create_pool() # start dfuse if api is POSIX if self.fio_cmd.api.value == "POSIX": # Connect to the pool, create container and then start dfuse # Uncomment below two lines once DAOS-3355 is resolved # self.pool.connect() # self.create_cont() self._start_dfuse() self.fio_cmd.update( "global", "directory", self.dfuse.mount_dir.value, "fio --name=global --directory") # Run Fio self.fio_cmd.hosts = self.hostlist_clients self.fio_cmd.run()