How to use the rally.task.atomic function in rally

To help you get started, we’ve selected a few rally examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / rally / tests / unit / task / test_atomic.py View on Github external
            @atomic.action_timer("some")
            def some_func(self, a, b):
                return a + b
github openstack / rally / rally / plugins / openstack / scenarios / cinder / volumes.py View on Github external
:param size: volume size (integer, in GB) or
                     dictionary, must contain two values:
                         min - minimum size volumes will be created as;
                         max - maximum size volumes will be created as.
        :param image: image to be used to create initial volume
        :param nested_level: amount of nested levels
        :param kwargs: optional args to create volumes
        """
        if image:
            kwargs["imageRef"] = image

        source_vol = self.cinder.create_volume(size, **kwargs)

        kwargs.pop("imageRef", None)
        for i in range(nested_level):
            with atomic.ActionTimer(self, "cinder.clone_volume"):
                source_vol = self.cinder.create_volume(
                    source_vol.size, source_volid=source_vol.id,
                    **kwargs)
github openstack / rally / rally / plugins / openstack / scenarios / glance / utils.py View on Github external
    @atomic.action_timer("glance.list_images")
    def _list_images(self):
        """Returns user images list."""
        return list(self.clients("glance").images.list())
github openstack / rally-openstack / rally_openstack / services / key_manager / barbican.py View on Github external
    @atomic.action_timer("barbican.orders_get")
    def orders_get(self, order_ref):
        """Get the order

        :param order_ref: The order reference
        """
        return self._clients.barbican().orders.get(order_ref)
github openstack / rally / rally / plugins / openstack / scenarios / neutron / utils.py View on Github external
    @atomic.action_timer("neutron.show_security_group_rule")
    def _show_security_group_rule(self, security_group_rule, **kwargs):
        """Show information of a given security group rule.

        :param security_group_rule: id of security group rule
        :param kwargs: Optional additional arguments for roles list
        :return: details of security group rule
        """
        return self.clients("neutron").show_security_group_rule(
            security_group_rule, **kwargs)
github openstack / rally-openstack / rally_openstack / scenarios / ec2 / utils.py View on Github external
    @atomic.action_timer("ec2.boot_servers")
    def _boot_servers(self, image_id, flavor_name,
                      instance_num=1, **kwargs):
        """Boot multiple servers.

        Returns when all the servers are actually booted and are in the
        "Running" state.

        :param image_id: ID of the image to be used for server creation
        :param flavor_name: Name of the flavor to be used for server creation
        :param instance_num: Number of instances to boot
        :param kwargs: Other optional parameters to boot servers

        :returns: List of created server objects
        """
        reservation = self.clients("ec2").run_instances(
            image_id=image_id,
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
    @atomic.action_timer("nova.list_servers")
    def _list_servers(self, detailed=True):
        """Returns user servers list."""
        return self.clients("nova").servers.list(detailed)
github openstack / ec2-api / rally-scenarios / plugins / ec2api_plugin.py View on Github external
def run(self):
        client = self.get_ec2_client()
        with atomic.ActionTimer(self, 'describe_regions_ec2api'):
            data = client.describe_regions()
github openstack / rally-openstack / rally_openstack / scenarios / designate / utils.py View on Github external
    @atomic.action_timer("designate.list_zones")
    def _list_zones(self, criterion=None, marker=None, limit=None):
        """Return user zone list.

        :param criterion: API Criterion to filter by
        :param marker: UUID marker of the item to start the page from
        :param limit: How many items to return in the page.
        :returns: list of designate zones
        """
        return self.clients("designate", version="2").zones.list()
github openstack / rally-openstack / rally_openstack / scenarios / senlin / utils.py View on Github external
    @atomic.action_timer("senlin.create_cluster")
    def _create_cluster(self, profile_id, desired_capacity=0, min_size=0,
                        max_size=-1, timeout=60, metadata=None):
        """Create a new cluster from attributes.

        :param profile_id: ID of profile used to create cluster
        :param desired_capacity: The capacity or initial number of nodes
                                 owned by the cluster
        :param min_size: The minimum number of nodes owned by the cluster
        :param max_size: The maximum number of nodes owned by the cluster.
                         -1 means no limit
        :param timeout: The timeout value in minutes for cluster creation
        :param metadata: A set of key value pairs to associate with the cluster

        :returns: object of cluster created.
        """
        attrs = {