Beispiel #1
0
    def get_environment(self, manager, log_file=None):
        """Get the environment variables to export for the command.

        Args:
            manager (DaosServerManager): the job manager used to start
                daos_server from which the server config values can be obtained
                to set the required environment variables.
            log_file (str, optional): when specified overrides the default
                D_LOG_FILE value. Defaults to None.

        Returns:
            EnvironmentVariables: a dictionary of environment variable names and
                values to export.

        """
        env = EnvironmentVariables()
        for name in self._env_names:
            if name == "D_LOG_FILE":
                if not log_file:
                    log_file = "{}_daos.log".format(self.command)
                value = get_log_file(log_file)
            else:
                value = manager.get_environment_value(name)
            env[name] = value

        return env
Beispiel #2
0
    def start_additional_servers(self, additional_servers, index=0):
        """Start additional servers.

        This method can be used to start a new daos_server during a test.

        Args:
            additional_servers (list of str): List of hostnames to start
                daos_server.
            index (int): Determines which server_managers to use when creating
                the new server.
        """
        self.server_managers.append(
            DaosServerManager(self.server_managers[index].manager.job,
                              self.manager_class,
                              self.server_managers[index].dmg.yaml))
        self.server_managers[-1].manager.assign_environment(
            EnvironmentVariables({"PATH": None}), True)
        self.server_managers[-1].hosts = (additional_servers, self.workdir,
                                          self.hostfile_servers_slots)

        self.log.info("Starting %s: group=%s, hosts=%s, config=%s", "server",
                      self.server_managers[-1].get_config_value("name"),
                      self.server_managers[-1].hosts,
                      self.server_managers[-1].get_config_value("filename"))
        self.server_managers[-1].verify_socket_directory(getuser())
        self.server_managers[-1].start()
Beispiel #3
0
    def __init__(self, group, bin_dir, cert_dir, config_file, config_temp=None,
                 manager="Orterun"):
        """Initialize a DaosAgentManager object.

        Args:
            group (str): daos_server group name
            bin_dir (str): directory from which to run daos_agent
            cert_dir (str): directory in which to copy certificates
            config_file (str): daos_agent configuration file name and path
            config_temp (str, optional): file name and path used to generate
                the daos_agent configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            manager (str, optional): the name of the JobManager class used to
                manage the YamlCommand defined through the "job" attribute.
                Defaults to "Orterun".
        """
        agent_command = get_agent_command(
            group, cert_dir, bin_dir, config_file, config_temp)
        super(DaosAgentManager, self).__init__(agent_command, manager)

        # Set the correct certificate file ownership
        if manager == "Systemctl":
            self.manager.job.certificate_owner = "daos_agent"

        # Set default agent debug levels
        env_vars = {
            "D_LOG_MASK": "DEBUG,RPC=ERR",
            "DD_MASK": "mgmt,io,md,epc,rebuild"
        }
        self.manager.assign_environment_default(EnvironmentVariables(env_vars))
Beispiel #4
0
    def get_interface_envs(self, index=0):
        """Get the environment variable names and values for the interfaces.

        Args:
            index (int, optional): server index from which to obtain the
                environment variable values. Defaults to 0.

        Returns:
            EnvironmentVariables: a dictionary of environment variable names
                and their values extracted from the daos_server yaml
                configuration file.

        """
        env = EnvironmentVariables()
        mapping = {
            "OFI_INTERFACE": "fabric_iface",
            "OFI_PORT": "fabric_iface_port",
            "CRT_PHY_ADDR_STR": "provider",
        }
        for key, name in mapping.items():
            value = self.server_params[index].get_value(name)
            if value is not None:
                env[key] = value

        return env
Beispiel #5
0
    def run_test(self):
        """Run the HDF5 VOL testsuites.

        Raises:
            VolFailed: for an invalid test name or test execution failure

        """
        # initialize test specific variables
        mpi_type = self.params.get("mpi_type", default="mpich")
        test_repo = self.params.get("daos_vol_repo")
        plugin_path = self.params.get("plugin_path")
        # test_list = self.params.get("daos_vol_tests", default=[])
        testname = self.params.get("testname")
        client_processes = self.params.get("client_processes")

        # create pool, container and dfuse mount
        self.add_pool(connect=False)
        self.add_container(self.pool)

        # VOL needs to run from a file system that supports xattr.
        #  Currently nfs does not have this attribute so it was recommended
        #  to create a dfuse dir and run vol tests from there.
        # create dfuse container
        self.start_dfuse(self.hostlist_clients, self.pool, self.container)

        # for test_param in test_list:
        # testname = test_param[0][1]
        # client_processes = test_param[1][1]
        exe = os.path.join(test_repo, testname)
        if mpi_type == "openmpi":
            manager = Orterun(exe, subprocess=False)
        else:
            manager = Mpirun(exe, subprocess=False, mpitype="mpich")

        env = EnvironmentVariables()
        env["DAOS_POOL"] = "{}".format(self.pool.uuid)
        env["DAOS_SVCL"] = "{}".format(self.pool.svc_ranks[0])
        env["DAOS_CONT"] = "{}".format(self.container.uuid)
        env["HDF5_VOL_CONNECTOR"] = "daos"
        env["HDF5_PLUGIN_PATH"] = "{}".format(plugin_path)
        manager.assign_hosts(self.hostlist_clients)
        manager.assign_processes(client_processes)
        manager.assign_environment(env, True)
        manager.working_dir.value = self.dfuse.mount_dir.value

        # run VOL Command
        try:
            manager.run()
        except CommandFailure as _error:
            self.fail("{} FAILED> \nException occurred: {}".format(
                exe, str(_error)))
    def assign_environment(self, env_vars, append=False):
        """Assign or add environment variables to the command.

        Args:
            env_vars (EnvironmentVariables): the environment variables to use
                assign or add to the command
            append (bool): whether to assign (False) or append (True) the
                specified environment variables
        """
        if append and self.export.value is not None:
            # Convert the current list of environmental variable assignments
            # into an EnvironmentVariables (dict) object.  Then update the
            # dictionary keys with the specified values or add new key value
            # pairs to the dictionary.  Finally convert the updated dictionary
            # back to a string for the parameter assignment.
            original = EnvironmentVariables({
                item.split("=")[0]: item.split("=")[1] if "=" in item else None
                for item in self.export.value.split(",")})
            original.update(env_vars)
            self.export.value = ",".join(original.get_list())
        else:
            # Overwrite the environmental variable assignment
            self.export.value = ",".join(env_vars.get_list())
Beispiel #7
0
    def assign_environment(self, env_vars, append=False):
        """Assign or add environment variables to the command.

        Args:
            env_vars (EnvironmentVariables): the environment variables to use
                assign or add to the command
            append (bool): whether to assign (False) or append (True) the
                specified environment variables
        """
        # Pass the environment variables via the process.run method env argument
        if append and self.env is not None:
            # Update the existing dictionary with the new values
            self.env.update(env_vars)
        else:
            # Overwrite/create the dictionary of environment variables
            self.env = EnvironmentVariables(env_vars)
Beispiel #8
0
    def __init__(self, agent_command, manager="Orterun"):
        """Create a DaosAgentManager object.

        Args:
            agent_command (DaosAgentCommand): daos_agent command class
            manager (str, optional): the name of the JobManager class used to
                manage the YamlCommand defined through the "job" attribute.
                Defaults to "OpenMpi"
        """
        super(DaosAgentManager, self).__init__(agent_command, manager)

        # Set default agent debug levels
        env_vars = {
            "D_LOG_MASK": "DEBUG,RPC=ERR",
            "DD_MASK": "mgmt,io,md,epc,rebuild"
        }
        self.manager.assign_environment_default(EnvironmentVariables(env_vars))
Beispiel #9
0
    def run_test(self, plugin_path, test_repo):
        """Run the HDF5 VOL testsuites.

        Raises:
            VolFailed: for an invalid test name or test execution failure

        """
        # initialize test specific variables
        # test_list = self.params.get("daos_vol_tests", default=[])
        testname = self.params.get("testname")
        client_processes = self.params.get("client_processes")

        # create pool, container and dfuse mount
        self.add_pool(connect=False)
        self.add_container(self.pool)

        # VOL needs to run from a file system that supports xattr.
        #  Currently nfs does not have this attribute so it was recommended
        #  to create a dfuse dir and run vol tests from there.
        # create dfuse container
        self.start_dfuse(self.hostlist_clients, self.pool, self.container)

        # Assign the test to run
        self.job_manager.job = ExecutableCommand(namespace=None,
                                                 command=testname,
                                                 path=test_repo,
                                                 check_results=["FAILED"])

        env = EnvironmentVariables()
        env["DAOS_POOL"] = "{}".format(self.pool.uuid)
        env["DAOS_SVCL"] = "{}".format(",".join(
            [str(item) for item in self.pool.svc_ranks]))
        env["DAOS_CONT"] = "{}".format(self.container.uuid)
        env["HDF5_VOL_CONNECTOR"] = "daos"
        env["HDF5_PLUGIN_PATH"] = "{}".format(plugin_path)
        self.job_manager.assign_hosts(self.hostlist_clients)
        self.job_manager.assign_processes(client_processes)
        self.job_manager.assign_environment(env, True)
        self.job_manager.working_dir.value = self.dfuse.mount_dir.value

        # run VOL Command
        try:
            self.job_manager.run()
        except CommandFailure as _error:
            self.fail("{} FAILED> \nException occurred: {}".format(
                self.job_manager.job, str(_error)))
Beispiel #10
0
    def __init__(self, *args, **kwargs):
        """Initialize a PerformanceTestBase object."""
        super().__init__(*args, **kwargs)

        # Need to restart so daos_metrics and system state is fresh
        self.start_servers_once = False

        self.dmg_cmd = None
        self.daos_cmd = None
        self._performance_log_dir = self.outputdir
        self._performance_log_name = os.path.join(self._performance_log_dir,
                                                  "performance.log")
        self.engines_per_host = 0
        self.num_servers = 0
        self.num_targets = 0
        self.num_clients = 0
        self.phase_barrier_s = 0
        self.performance_env = EnvironmentVariables()
Beispiel #11
0
    def configure_manager(self, name, manager, hosts, slots, access_list=None):
        """Configure the agent/server manager object.

        Defines the environment variables, host list, and hostfile settings used
        to start the agent/server manager.

        Args:
            name (str): manager name
            manager (SubprocessManager): the daos agent/server process manager
            hosts (list): list of hosts on which to start the daos agent/server
            slots (int): number of slots per server to define in the hostfile
            access_list (list): list of access point hosts
        """
        self.log.info("--- CONFIGURING %s MANAGER ---", name.upper())
        if access_list is None:
            access_list = self.hostlist_servers
        # Calling get_params() will set the test-specific log names
        manager.get_params(self)
        # Only use the first host in the access list
        manager.set_config_value("access_points", access_list[:1])
        manager.manager.assign_environment(
            EnvironmentVariables({"PATH": None}), True)
        manager.hosts = (hosts, self.workdir, slots)
Beispiel #12
0
 def __init__(self, *args, **kwargs):
     """Initialize a CartSelfTest object."""
     super(CartSelfTest, self).__init__(*args, **kwargs)
     self.setup_start_servers = False
     self.uri_file = None
     self.cart_env = EnvironmentVariables()
Beispiel #13
0
    def run_mpiio_tests(self, hostfile, pool_uuid, test_repo,
                        test_name, client_processes, cont_uuid):
        """Run the LLNL, MPI4PY, and HDF5 testsuites.

        Args:
            hostfile (str): client hostfile
            pool_uuid (str): pool UUID
            test_repo (str): test repo location
            test_name (str): name of test to be tested
            client_processes (int): number of client processes
            cont_uuid (str): container UUID

        Raises:
            MpioFailed: for an invalid test name or test execution failure

        Return:
            CmdResult: an avocado.utils.process CmdResult object containing the
                result of the command execution.

        """
        print("self.mpichinstall: {}".format(self.mpichinstall))

        # environment variables only to be set on client node
        env = EnvironmentVariables()
        env["DAOS_POOL"] = "{}".format(pool_uuid)
        env["DAOS_CONT"] = "{}".format(cont_uuid)
        env["DAOS_BYPASS_DUNS"] = "1"
        mpirun = os.path.join(self.mpichinstall, "bin", "mpirun")

        executables = {
            "romio": [os.path.join(test_repo, "runtests")],
            "llnl": [os.path.join(test_repo, "testmpio_daos")],
            "mpi4py": [os.path.join(test_repo, "test_io_daos.py")],
            "hdf5": [
                os.path.join(test_repo, "testphdf5"),
                os.path.join(test_repo, "t_shapesame")
            ]
        }

        # Verify the test name is valid
        if test_name not in executables:
            raise MpioFailed(
                "Invalid test name: {} not supported".format(test_name))

        # Verify the executables exist for the valid test name
        if not all([os.path.join(exe) for exe in executables[test_name]]):
            raise MpioFailed(
                "Missing test name: {} missing executables {}".format(
                    test_name, ", ".join(executables[test_name])))

        # Setup the commands to run for this test name
        commands = []
        if test_name == "romio":
            commands.append(
                "{} -fname=daos:test1 -subset".format(
                    executables[test_name][0]))
        elif test_name == "llnl":
            env["MPIO_USER_PATH"] = "daos:"
            for exe in executables[test_name]:
                commands.append(
                    "{} -np {} --hostfile {} {} 1".format(
                        mpirun, client_processes, hostfile, exe))
        elif test_name == "mpi4py":
            for exe in executables[test_name]:
                commands.append(
                    "{} -np {} --hostfile {} python {}".format(
                        mpirun, client_processes, hostfile, exe))
        elif test_name == "hdf5":
            env["HDF5_PARAPREFIX"] = "daos:"
            for exe in executables[test_name]:
                commands.append(
                    "{} -np {} --hostfile {} {}".format(
                        mpirun, client_processes, hostfile, exe))

        for command in commands:
            print("run command: {}".format(command))
            try:
                result = run_command(
                    command, timeout=None, verbose=True, env=env)

            except DaosTestError as excep:
                raise MpioFailed(
                    "<Test FAILED> \nException occurred: {}".format(
                        str(excep))) from excep

        return result
Beispiel #14
0
 def __init__(self, *args, **kwargs):
     """Initialize a CartSelfTest object."""
     super().__init__(*args, **kwargs)
     self.uri_file = None
     self.cart_env = EnvironmentVariables()
Beispiel #15
0
    def run_test(self, test_repo, test_name):
        """Execute function to be used by test functions below.

        test_repo       --absolute or relative location of test repository
        test_name       --name of the test to be run
        """
        # Select the commands to run
        if test_name not in self._test_name_class:
            self.fail("Unknown mpiio test name: {}".format(test_name))

        # initialize test specific variables
        client_processes = self.params.get("np", '/run/client_processes/')

        # Create pool
        self.add_pool(connect=False)

        # create container
        self.add_container(self.pool)

        # Pass pool and container information to the commands
        env = EnvironmentVariables()
        env["DAOS_UNS_PREFIX"] = "daos://{}/{}/".format(
            self.pool.uuid, self.container.uuid)
        if test_name == "llnl":
            env["MPIO_USER_PATH"] = "daos:/"

        # Create commands
        kwargs_list = [{"path": test_repo}]
        if test_name == "hdf5":
            kwargs_list[0]["command"] = "testphdf5"
            kwargs_list.append(kwargs_list[0].copy())
            kwargs_list[1]["command"] = "t_shapesame"
            env["HDF5_PARAPREFIX"] = "daos:"

        self.job_manager = []
        job_managers = []
        for kwargs in kwargs_list:
            manager = get_job_manager(self)

            # fix up a relative test_repo specification
            if not kwargs["path"].startswith("/"):
                mpi_path = os.path.split(manager.command_path)[0]
                kwargs["path"] = os.path.join(mpi_path, kwargs["path"])
            if test_name == "romio":
                # Romio is not run via mpirun
                romio_job = self._test_name_class[test_name](**kwargs)
                romio_job.env = env
                job_managers.append(romio_job)
                self.job_manager[-1] = romio_job
            else:
                # finish job manager setup
                job_managers.append(manager)
                job_managers[-1].job = self._test_name_class[test_name](
                    **kwargs)
                job_managers[-1].assign_hosts(self.hostlist_clients)
                job_managers[-1].assign_processes(client_processes)
                job_managers[-1].assign_environment(env, True)

            # Add a list of bad words that if found should fail the command
            job_managers[-1].check_results_list = [
                "non-zero exit code", "MPI_Abort", "MPI_ABORT", "ERROR"
            ]

        for job_manager in job_managers:
            try:
                job_manager.run()
            except CommandFailure as error:
                self.fail("<{0} Test Failed> \n{1}".format(test_name, error))