示例#1
0
 def __init__(self):
     """Create a dmg pool delete-acl command object."""
     super(DmgCommand.PoolSubCommand.DeleteAclSubCommand,
           self).__init__("/run/dmg/pool/delete-acl/*",
                          "delete-acl")
     self.pool = FormattedParameter("--pool={}", None)
     self.principal = FormattedParameter("-p {}", None)
示例#2
0
 def __init__(self):
     """Create a daos container create command object."""
     super(DaosCommand.ContainerSubCommand.CreateSubCommand,
           self).__init__("create")
     self.type = FormattedParameter("--type={}")
     self.oclass = FormattedParameter("--oclass={}")
     self.chunk_size = FormattedParameter("--chunk_size={}")
示例#3
0
 def __init__(self):
     """Create a dmg pool destroy command object."""
     super(DmgCommand.PoolSubCommand.DestroySubCommand,
           self).__init__("/run/dmg/pool/destroy/*", "destroy")
     self.pool = FormattedParameter("--pool={}", None)
     self.sys_name = FormattedParameter("--sys-name={}", None)
     self.force = FormattedParameter("--force", False)
示例#4
0
 def __init__(self):
     """Create a dmg pool overwrite-acl command object."""
     super(DmgCommand.PoolSubCommand.OverwriteAclSubCommand,
           self).__init__("/run/dmg/pool/overwrite-acl/*",
                          "overwrite-acl")
     self.pool = FormattedParameter("--pool={}", None)
     self.acl_file = FormattedParameter("-a {}", None)
示例#5
0
 def __init__(self):
     """Create a dmg pool set-prop command object."""
     super(DmgCommand.PoolSubCommand.SetPropSubCommand,
           self).__init__("/run/dmg/pool/set-prop/*", "set-prop")
     self.pool = FormattedParameter("--pool={}", None)
     self.name = FormattedParameter("--name={}", None)
     self.value = FormattedParameter("--value={}", None)
示例#6
0
 def __init__(self):
     """Create a daos container destroy-snap command object."""
     super(DaosCommand.ContainerSubCommand.DestroySnapSubCommand,
           self).__init__("destroy-snap")
     self.snap = FormattedParameter("--snap={}")
     self.epc = FormattedParameter("--epc={}")
     self.eprange = FormattedParameter("--eprange={}")
示例#7
0
 def __init__(self):
     """Create a daos container create command object."""
     super(DaosCommand.ContainerSubCommand.CreateSubCommand,
           self).__init__("create")
     # Additional daos container create parameters:
     #   --type=CTYPESTR
     #           container type (HDF5, POSIX)
     self.type = FormattedParameter("--type={}")
     #   --oclass=OCLSSTR
     #           container object class:
     #               S1, S2, S4, SX, RP_2G1, RP_2G2, RP_2GX, RP_3G1,
     #               RP_3G2, RP_3GX, RP_4G1, RP_4G2, RP_4GX, RP_XSF,
     #               S1_ECHO, RP_2G1_ECHO, RP_3G1_ECHO, RP_4G1_ECHO,
     #               RP_3G1_SR, RP_2G1_SR, S1_SR, EC_2P1G1, EC_2P2G1,
     #               EC_8P2G1
     self.oclass = FormattedParameter("--oclass={}")
     #   --chunk_size=BYTES
     #           chunk size of files created. Supports suffixes:
     #               K (KB), M (MB), G (GB), T (TB), P (PB), E (EB)
     self.chunk_size = FormattedParameter("--chunk_size={}")
     #   --properties=<name>:<value>[,<name>:<value>,...]
     #           - supported names:
     #               label, cksum, cksum_size, srv_cksum, rf
     #           - supported values:
     #               label:      <any string>
     #               cksum:      off, crc[16,32,64], sha1
     #               cksum_size: <any size>
     #               srv_cksum:  on, off
     #               rf:         [0-4]
     self.properties = FormattedParameter("--properties={}")
示例#8
0
 def __init__(self):
     """Create a dmg storage query smd object."""
     super(
         DmgCommand.StorageSubCommand.QuerySubCommand.
         SmdSubCommand,
         self).__init__("/run/dmg/storage/query/smd/*", "smd")
     self.devices = FormattedParameter("-d", False)
     self.pools = FormattedParameter("-p", False)
示例#9
0
 def __init__(self):
     """Create a dmg storage query blobstore-health object."""
     super(
         DmgCommand.StorageSubCommand.QuerySubCommand.
         BlobstoreHealthSubCommand, self).__init__(
             "/run/dmg/storage/query/blobstore-health/*",
             "blobstore-health")
     self.devuuid = FormattedParameter("-u {}", None)
     self.tgtid = FormattedParameter("-t {}", None)
示例#10
0
    def __init__(self, namespace, command):
        """Create a dfuse Command object."""
        super(DfuseCommand, self).__init__(namespace, command)

        # dfuse options
        self.puuid = FormattedParameter("--pool {}")
        self.cuuid = FormattedParameter("--container {}")
        self.mount_dir = FormattedParameter("--mountpoint {}")
        self.svcl = FormattedParameter("--svc {}", 0)
        self.sys_name = FormattedParameter("--sys-name {}")
        self.singlethreaded = FormattedParameter("--singlethreaded", False)
        self.foreground = FormattedParameter("--foreground", False)
示例#11
0
            def __init__(self, sub_command):
                """Create a common daos pool sub-command object.

                Args:
                    sub_command (str): sub-command name
                """
                super(DaosCommand.PoolSubCommand.CommonPoolSubCommand,
                      self).__init__("/run/daos/pool/{}/*".format(sub_command),
                                     sub_command)
                self.pool = FormattedParameter("--pool={}")
                self.sys_name = FormattedParameter("--sys-name={}")
                self.svc = FormattedParameter("--svc={}")
                self.sys = FormattedParameter("--sys={}")
示例#12
0
 def __init__(self):
     """Create a start subcommand object."""
     super(DaosServer.ServerStartSubCommand,
           self).__init__("/run/daos_server/start/*", "start")
     self.port = FormattedParameter("-p {}")
     self.storage = FormattedParameter("-s {}")
     self.modules = FormattedParameter("-m {}")
     self.targets = FormattedParameter("-t {}")
     self.xshelpernr = FormattedParameter("-x {}")
     self.firstcore = FormattedParameter("-f {}")
     self.group = FormattedParameter("-g {}")
     self.sock_dir = FormattedParameter("-d {}")
     self.insecure = FormattedParameter("-i", True)
     self.recreate = FormattedParameter("--recreate-superblocks", False)
示例#13
0
            def __init__(self, sub_command):
                """Create a common daos object sub-command object.

                Args:
                    sub_command (str): sub-command name
                """
                super(DaosCommand.ObjectSubCommand.CommonObjectSubCommand,
                      self).__init__(
                          "/run/daos/object/{}/*".format(sub_command),
                          sub_command)
                self.pool = FormattedParameter("--pool={}")
                self.sys_name = FormattedParameter("--sys-name={}")
                self.svc = FormattedParameter("--svc={}")
                self.cont = FormattedParameter("--cont={}")
                self.oid = FormattedParameter("--oid={}")
示例#14
0
    def __init__(self, path, host):
        """Create a daos_racer command object.

        Args:
            path (str): path of the daos_racer command
            host (str): host on which to run the daos_racer command
        """
        super(DaosRacerCommand, self).__init__(
            "/run/daos_racer", "daos_racer", path)
        self.host = host

        # Number of seconds to run
        self.runtime = FormattedParameter("-t {}", 60)

        # Optional timeout for the clush command running the daos_racer command.
        # This should be set greater than the 'runtime' value but less than the
        # avocado test timeout value to allow for proper cleanup.  Using a value
        # of None will result in no timeout being used.
        self.clush_timeout = BasicParameter(None)

        # Environment variable names required to be set when running the
        # daos_racer command.  The values for these names are populated by the
        # get_environment() method and added to command line by the
        # set_environment() method.
        self._env_names = ["OFI_INTERFACE", "CRT_PHY_ADDR_STR", "D_LOG_FILE"]
示例#15
0
            def __init__(self, sub_command):
                """Create a common daos container sub-command object.

                Args:
                    sub_command (str): sub-command name
                """
                super(
                    DaosCommand.ContainerSubCommand.CommonContainerSubCommand,
                    self).__init__(
                        "/run/daos/container/{}/*".format(sub_command),
                        sub_command)
                self.pool = FormattedParameter("--pool={}")
                self.sys_name = FormattedParameter("--sys-name={}")
                self.svc = FormattedParameter("--svc={}")
                self.cont = FormattedParameter("--cont={}")
                self.path = FormattedParameter("--path={}")
示例#16
0
    def __init__(self, path=""):
        """Create a server command object.

        Args:
            path (str): path to location of daos_server binary.
        """
        super(DaosServer, self).__init__("/run/daos_server/*", "daos_server",
                                         path)

        self.yaml_params = DaosServerConfig()
        self.timeout = 120
        self.server_list = []
        self.mode = "normal"

        self.debug = FormattedParameter("-b", True)
        self.json = FormattedParameter("-j", False)
        self.config = FormattedParameter("-o {}")
示例#17
0
 def __init__(self):
     """Create a dmg Command object."""
     super(DmgCommand.DmgCreateSubCommand,
           self).__init__("/run/dmg/create/*", "create")
     self.group = FormattedParameter("-g {}")
     self.user = FormattedParameter("-u {}")
     self.acl_file = FormattedParameter("-a {}")
     self.scm_size = FormattedParameter("-s {}")
     self.nvme_size = FormattedParameter("-n {}")
     self.ranks = FormattedParameter("-r {}")
     self.nsvc = FormattedParameter("-v {}")
     self.sys = FormattedParameter("-S {}")
示例#18
0
 def __init__(self):
     """Create a dmg pool create command object."""
     super(DmgCommand.PoolSubCommand.CreateSubCommand,
           self).__init__("/run/dmg/pool/create/*", "create")
     self.group = FormattedParameter("--group={}", None)
     self.user = FormattedParameter("--user={}", None)
     self.acl_file = FormattedParameter("--acl-file={}", None)
     self.scm_size = FormattedParameter("--scm-size={}", None)
     self.nvme_size = FormattedParameter("--nvme-size={}", None)
     self.ranks = FormattedParameter("--ranks={}", None)
     self.nsvc = FormattedParameter("--nsvc={}", None)
     self.sys = FormattedParameter("--sys={}", None)
示例#19
0
 def __init__(self):
     """Create a dmg storage prepare command object."""
     super(DmgCommand.StorageSubCommand.PrepareSubCommand,
           self).__init__("/run/dmg/storage/prepare/*", "prepare")
     self.pci_whitelist = FormattedParameter("-w {}", None)
     self.hugepages = FormattedParameter("-p {}", None)
     self.target_user = FormattedParameter("-u {}", None)
     self.nvme_only = FormattedParameter("-n", False)
     self.scm_only = FormattedParameter("-s", False)
     self.reset = FormattedParameter("--reset", False)
     self.force = FormattedParameter("-f", False)
示例#20
0
 def __init__(self):
     """Create a dmg Command object."""
     super(DmgCommand.DmgPrepareSubCommand,
           self).__init__("/run/dmg/prepare/*", "prepare")
     self.pci_wl = FormattedParameter("-w {}")
     self.hugepages = FormattedParameter("-p {}")
     self.targetuser = FormattedParameter("-u {}")
     self.nvmeonly = FormattedParameter("-n", False)
     self.scmonly = FormattedParameter("-s", False)
     self.force = FormattedParameter("-f", False)
     self.reset = FormattedParameter("--reset", False)
示例#21
0
    def __init__(self, path):
        """Create a dmg Command object."""
        super(DmgCommand, self).__init__("/run/dmg/*", "dmg", path)

        self.hostlist = FormattedParameter("-l {}")
        self.hostfile = FormattedParameter("-f {}")
        self.configpath = FormattedParameter("-o {}")
        self.insecure = FormattedParameter("-i", True)
        self.debug = FormattedParameter("-d", False)
        self.json = FormattedParameter("-j", False)
示例#22
0
class DfuseCommand(ExecutableCommand):
    """Defines a object representing a dfuse command."""

    def __init__(self, namespace, command):
        """Create a dfuse Command object."""
        super(DfuseCommand, self).__init__(namespace, command)

        # dfuse options
        self.puuid = FormattedParameter("--pool {}")
        self.cuuid = FormattedParameter("--container {}")
        self.mount_dir = FormattedParameter("--mountpoint {}")
        self.svcl = FormattedParameter("--svc {}", 0)
        self.sys_name = FormattedParameter("--sys-name {}")
        self.singlethreaded = FormattedParameter("--singlethreaded", False)
        self.foreground = FormattedParameter("--foreground", False)

    def set_dfuse_params(self, pool, display=True):
        """Set the dfuse parameters for the DAOS group, pool, and container uuid
        Args:
            pool (TestPool): DAOS test pool object
            display (bool, optional): print updated params. Defaults to True.
        """
        self.set_dfuse_pool_params(pool, display)

    def set_dfuse_pool_params(self, pool, display=True):
        """Set Dfuse params based on Daos Pool.
        Args:
            pool (TestPool): DAOS test pool object
            display (bool, optional): print updated params. Defaults to True.
        """
        self.puuid.update(pool.uuid, "puuid" if display else None)
        self.set_dfuse_svcl_param(pool, display)

    def set_dfuse_svcl_param(self, pool, display=True):
        """Set the dfuse svcl param from the ranks of a DAOS pool object.
        Args:
            pool (TestPool): DAOS test pool object
            display (bool, optional): print updated params. Defaults to True.
        """

        svcl = ":".join(
            [str(item) for item in [
                int(pool.pool.svc.rl_ranks[index])
                for index in range(pool.pool.svc.rl_nr)]])
        self.svcl.update(svcl, "svcl" if display else None)

    def set_dfuse_cont_param(self, cont, display=True):
        """Set dfuse cont param from Container object
        Args:
            cont (TestContainer): Daos test container object
            display (bool, optional): print updated params. Defaults to True.
        """
        self.cuuid.update(cont, "cuuid" if display else None)
示例#23
0
    def __init__(self, path="", env=None):
        """Create a ExecutableCommand object.

        Uses Avocado's utils.process module to run a command str provided.

        Args:
            command (str): string of the command to be executed.
            path (str, optional): path to location of command binary file.
                Defaults to ""
        """
        super(IoConfGen, self).__init__("/run/gen_io_conf/*",
                                        "daos_gen_io_conf", path)
        self.verbose = True
        self.env = env
        self.ranks = FormattedParameter("-g {}")
        self.targets = FormattedParameter("-t {}")
        self.obj_num = FormattedParameter("-o {}")
        self.akeys = FormattedParameter("-a {}")
        self.dkeys = FormattedParameter("-d {}")
        self.record_size = FormattedParameter("-s {}")
        self.obj_class = FormattedParameter("-O {}")
        self.filename = BasicParameter(None, "testfile")
示例#24
0
    def __init__(self, path, yaml_cfg=None):
        """Create a dmg Command object.

        Args:
            path (str): path to the dmg command
            yaml_cfg (DmgYamlParameters, optional): dmg config file
                settings. Defaults to None, in which case settings
                must be supplied as command-line paramters.
        """
        super(DmgCommand, self).__init__("/run/dmg/*", "dmg", path, yaml_cfg)

        # If specified use the configuration file from the YamlParameters object
        default_yaml_file = None
        if isinstance(self.yaml, YamlParameters):
            default_yaml_file = self.yaml.filename

        self._hostlist = FormattedParameter("-l {}")
        self.hostfile = FormattedParameter("-f {}")
        self.configpath = FormattedParameter("-o {}", default_yaml_file)
        self.insecure = FormattedParameter("-i", False)
        self.debug = FormattedParameter("-d", False)
        self.json = FormattedParameter("-j", False)
示例#25
0
    def __init__(self):
        """Create an IorCommand object."""
        super(IorCommand, self).__init__("/run/ior/*", "ior")

        # Flags
        self.flags = FormattedParameter("{}")

        # Optional arguments
        #   -a=POSIX        API for I/O [POSIX|DUMMY|MPIIO|MMAP|DAOS|DFS]
        #   -b=1048576      blockSize -- contiguous bytes to write per task
        #   -d=0            interTestDelay -- delay between reps in seconds
        #   -f=STRING       scriptFile -- test script name
        #   -G=0            setTimeStampSignature -- time stamp signature
        #   -i=1            repetitions -- number of repetitions of test
        #   -j=0            outlierThreshold -- warn on outlier N sec from mean
        #   -J=1            setAlignment -- HDF5 alignment in bytes
        #   -l=STRING       datapacket type-- type of packet created
        #   -M=STRING       memoryPerNode -- hog memory on the node
        #   -N=0            numTasks -- num of participating tasks in the test
        #   -o=testFile     testFile -- full name for test
        #   -O=STRING       string of IOR directives
        #   -Q=1            taskPerNodeOffset for read tests
        #   -s=1            segmentCount -- number of segments
        #   -t=262144       transferSize -- size of transfer in bytes
        #   -T=0            maxTimeDuration -- max time in minutes executing
        #                      repeated test; it aborts only between iterations
        #                      and not within a test!
        self.api = FormattedParameter("-a {}", "DAOS")
        self.block_size = FormattedParameter("-b {}")
        self.test_delay = FormattedParameter("-d {}")
        self.script = FormattedParameter("-f {}")
        self.signatute = FormattedParameter("-G {}")
        self.repetitions = FormattedParameter("-i {}")
        self.outlier_threshold = FormattedParameter("-j {}")
        self.alignment = FormattedParameter("-J {}")
        self.data_packet_type = FormattedParameter("-l {}")
        self.memory_per_node = FormattedParameter("-M {}")
        self.num_tasks = FormattedParameter("-N {}")
        self.test_file = FormattedParameter("-o {}")
        self.directives = FormattedParameter("-O {}")
        self.task_offset = FormattedParameter("-Q {}")
        self.segment_count = FormattedParameter("-s {}")
        self.transfer_size = FormattedParameter("-t {}")
        self.max_duration = FormattedParameter("-T {}")

        # Module DAOS
        #   Required arguments
        #       --daos.pool=STRING            pool uuid
        #       --daos.svcl=STRING            pool SVCL
        #       --daos.cont=STRING            container uuid
        #   Flags
        #       --daos.destroy                Destroy Container
        #   Optional arguments
        #       --daos.group=STRING           server group
        #       --daos.chunk_size=1048576     chunk size
        #       --daos.oclass=STRING          object class
        self.daos_pool = FormattedParameter("--daos.pool {}")
        self.daos_svcl = FormattedParameter("--daos.svcl {}")
        self.daos_cont = FormattedParameter("--daos.cont {}")
        self.daos_destroy = FormattedParameter("--daos.destroy", True)
        self.daos_group = FormattedParameter("--daos.group {}")
        self.daos_chunk = FormattedParameter("--daos.chunk_size {}", 1048576)
        self.daos_oclass = FormattedParameter("--daos.oclass {}", "SX")
示例#26
0
class IorCommand(ExecutableCommand):
    """Defines a object for executing an IOR command.

    Example:
        >>> # Typical use inside of a DAOS avocado test method.
        >>> ior_cmd = IorCommand()
        >>> ior_cmd.get_params(self)
        >>> ior_cmd.set_daos_params(self.server_group, self.pool)
        >>> mpirun = Mpirun()
        >>> env = self.ior_cmd.get_default_env(self.tmp, self.client_log)
        >>> processes = len(self.hostlist_clients)
        >>> mpirun.setup_command(env, self.hostfile_clients, processes)
        >>> mpirun.run()
    """
    def __init__(self):
        """Create an IorCommand object."""
        super(IorCommand, self).__init__("/run/ior/*", "ior")

        # Flags
        self.flags = FormattedParameter("{}")

        # Optional arguments
        #   -a=POSIX        API for I/O [POSIX|DUMMY|MPIIO|MMAP|DAOS|DFS]
        #   -b=1048576      blockSize -- contiguous bytes to write per task
        #   -d=0            interTestDelay -- delay between reps in seconds
        #   -f=STRING       scriptFile -- test script name
        #   -G=0            setTimeStampSignature -- time stamp signature
        #   -i=1            repetitions -- number of repetitions of test
        #   -j=0            outlierThreshold -- warn on outlier N sec from mean
        #   -J=1            setAlignment -- HDF5 alignment in bytes
        #   -l=STRING       datapacket type-- type of packet created
        #   -M=STRING       memoryPerNode -- hog memory on the node
        #   -N=0            numTasks -- num of participating tasks in the test
        #   -o=testFile     testFile -- full name for test
        #   -O=STRING       string of IOR directives
        #   -Q=1            taskPerNodeOffset for read tests
        #   -s=1            segmentCount -- number of segments
        #   -t=262144       transferSize -- size of transfer in bytes
        #   -T=0            maxTimeDuration -- max time in minutes executing
        #                      repeated test; it aborts only between iterations
        #                      and not within a test!
        self.api = FormattedParameter("-a {}", "DAOS")
        self.block_size = FormattedParameter("-b {}")
        self.test_delay = FormattedParameter("-d {}")
        self.script = FormattedParameter("-f {}")
        self.signatute = FormattedParameter("-G {}")
        self.repetitions = FormattedParameter("-i {}")
        self.outlier_threshold = FormattedParameter("-j {}")
        self.alignment = FormattedParameter("-J {}")
        self.data_packet_type = FormattedParameter("-l {}")
        self.memory_per_node = FormattedParameter("-M {}")
        self.num_tasks = FormattedParameter("-N {}")
        self.test_file = FormattedParameter("-o {}")
        self.directives = FormattedParameter("-O {}")
        self.task_offset = FormattedParameter("-Q {}")
        self.segment_count = FormattedParameter("-s {}")
        self.transfer_size = FormattedParameter("-t {}")
        self.max_duration = FormattedParameter("-T {}")

        # Module DAOS
        #   Required arguments
        #       --daos.pool=STRING            pool uuid
        #       --daos.svcl=STRING            pool SVCL
        #       --daos.cont=STRING            container uuid
        #   Flags
        #       --daos.destroy                Destroy Container
        #   Optional arguments
        #       --daos.group=STRING           server group
        #       --daos.chunk_size=1048576     chunk size
        #       --daos.oclass=STRING          object class
        self.daos_pool = FormattedParameter("--daos.pool {}")
        self.daos_svcl = FormattedParameter("--daos.svcl {}")
        self.daos_cont = FormattedParameter("--daos.cont {}")
        self.daos_destroy = FormattedParameter("--daos.destroy", True)
        self.daos_group = FormattedParameter("--daos.group {}")
        self.daos_chunk = FormattedParameter("--daos.chunk_size {}", 1048576)
        self.daos_oclass = FormattedParameter("--daos.oclass {}", "SX")

    def get_param_names(self):
        """Get a sorted list of the defined IorCommand parameters."""
        # Sort the IOR parameter names to generate consistent ior commands
        all_param_names = super(IorCommand, self).get_param_names()

        # List all of the common ior params first followed by any daos-specific
        # params (except when using MPIIO).
        param_names = [name for name in all_param_names if "daos" not in name]
        if self.api.value not in ["MPIIO", "POSIX"]:
            param_names.extend(
                [name for name in all_param_names if "daos" in name])

        return param_names

    def set_daos_params(self, group, pool, cont_uuid=None, display=True):
        """Set the IOR parameters for the DAOS group, pool, and container uuid.

        Args:
            group (str): DAOS server group name
            pool (TestPool): DAOS test pool object
            cont_uuid (str, optional): the container uuid. If not specified one
                is generated. Defaults to None.
            display (bool, optional): print updated params. Defaults to True.
        """
        self.set_daos_pool_params(pool, display)
        self.daos_group.update(group, "daos_group" if display else None)
        self.daos_cont.update(cont_uuid if cont_uuid else uuid.uuid4(),
                              "daos_cont" if display else None)

    def set_daos_pool_params(self, pool, display=True):
        """Set the IOR parameters that are based on a DAOS pool.

        Args:
            pool (TestPool): DAOS test pool object
            display (bool, optional): print updated params. Defaults to True.
        """
        self.daos_pool.update(pool.pool.get_uuid_str(),
                              "daos_pool" if display else None)
        self.set_daos_svcl_param(pool, display)

    def set_daos_svcl_param(self, pool, display=True):
        """Set the IOR daos_svcl param from the ranks of a DAOS pool object.

        Args:
            pool (TestPool): DAOS test pool object
            display (bool, optional): print updated params. Defaults to True.
        """
        svcl = ":".join([
            str(item) for item in [
                int(pool.pool.svc.rl_ranks[index])
                for index in range(pool.pool.svc.rl_nr)
            ]
        ])
        self.daos_svcl.update(svcl, "daos_svcl" if display else None)

    def get_aggregate_total(self, processes):
        """Get the total bytes expected to be written by ior.

        Args:
            processes (int): number of processes running the ior command

        Returns:
            int: total number of bytes written

        Raises:
            CommandFailure: if there is an error obtaining the aggregate total

        """
        power = {"k": 1, "m": 2, "g": 3, "t": 4}
        total = processes
        for name in ("block_size", "segment_count"):
            item = getattr(self, name).value
            if item:
                sub_item = re.split(r"([^\d])", str(item))
                if sub_item > 0:
                    total *= int(sub_item[0])
                    if len(sub_item) > 1:
                        key = sub_item[1].lower()
                        if key in power:
                            total *= 1024**power[key]
                        else:
                            raise CommandFailure(
                                "Error obtaining the IOR aggregate total from "
                                "the {} - bad key: value: {}, split: {}, "
                                "key: {}".format(name, item, sub_item, key))
                else:
                    raise CommandFailure(
                        "Error obtaining the IOR aggregate total from the {}: "
                        "value: {}, split: {}".format(name, item, sub_item))

        # Account for any replicas
        try:
            # Extract the replica quantity from the object class string
            replica_qty = int(re.findall(r"\d+", self.daos_oclass.value)[0])
        except (TypeError, IndexError):
            # If the daos object class is undefined (TypeError) or it does not
            # contain any numbers (IndexError) then there is only one replica
            replica_qty = 1
        finally:
            total *= replica_qty

        return total

    def get_default_env(self, manager_cmd, attach_info, log_file=None):
        """Get the default enviroment settings for running IOR.

        Args:
            manager_cmd (str): job manager command
            attach_info (str): CART attach info path
            log_file (str, optional): log file. Defaults to None.

        Returns:
            EnvironmentVariables: a dictionary of environment names and values

        """
        env = EnvironmentVariables()
        env["CRT_ATTACH_INFO_PATH"] = attach_info
        env["MPI_LIB"] = "\"\""
        env["DAOS_SINGLETON_CLI"] = 1
        env["FI_PSM2_DISCONNECT"] = 1
        if log_file:
            env["D_LOG_FILE"] = log_file

        if "mpirun" in manager_cmd or "srun" in manager_cmd:
            env["DAOS_POOL"] = self.daos_pool.value
            env["DAOS_SVCL"] = self.daos_svcl.value
            env["FI_PSM2_DISCONNECT"] = 1
            env["IOR_HINT__MPI__romio_daos_obj_class"] = self.daos_oclass.value

        return env

    @staticmethod
    def get_ior_metrics(cmdresult):
        """Parse the CmdResult (output of the test) and look for
           the ior stdout and get the read and write metrics.

        Args:
            cmdresult (CmdResult): output of job manager

       Returns:
            metrics (tuple) : list of write and read metrics from ior run

        """
        ior_metric_summary = "Summary of all tests:"
        messages = cmdresult.stdout.splitlines()
        # Get the index whre the summary starts and add one to
        # get to the header.
        idx = messages.index(ior_metric_summary)
        # idx + 1 is header.
        # idx +2 and idx + 3 will give the write and read metrics.
        write_metrics = (" ".join(messages[idx + 2].split())).split()
        read_metrics = (" ".join(messages[idx + 3].split())).split()

        return (write_metrics, read_metrics)

    @staticmethod
    def log_metrics(logger, message, metrics):
        """Log the ior metrics

           Args:
               logger (log): logger object handle
               message (str) : Message to print before logging metrics
               metric (lst) : IOR write and read metrics
        """
        logger.info("\n")
        logger.info(message)
        for m in metrics:
            logger.info(m)
        logger.info("\n")
示例#27
0
 def __init__(self):
     """Create a dmg Command object."""
     super(DmgCommand.DmgDestroySubCommand,
           self).__init__("/run/dmg/destroy/*", "destroy")
     self.pool = FormattedParameter("--pool {}")
     self.force = FormattedParameter("-f", False)
示例#28
0
 def __init__(self):
     """Create a dmg Command object."""
     super(DmgCommand.DmgFormatSubCommand,
           self).__init__("/run/dmg/format/*", "format")
     self.force = FormattedParameter("-f", False)
示例#29
0
 def __init__(self):
     """Create a dmg system query command object."""
     super(DmgCommand.SystemSubCommand.QuerySubCommand,
           self).__init__("/run/dmg/system/query/*", "query")
     self.rank = FormattedParameter("--rank={}")
     self.verbose = FormattedParameter("--verbose", False)
示例#30
0
 def __init__(self):
     """Create a dmg system stop command object."""
     super(DmgCommand.SystemSubCommand.StopSubCommand,
           self).__init__("/run/dmg/system/stop/*", "stop")
     self.force = FormattedParameter("--force", False)