def _create_containers(self, context, containers_per_tenant, threads):
        """Create containers and store results in Rally context.

        :param context: dict, Rally context environment
        :param containers_per_tenant: int, number of containers to create
                                      per tenant
        :param threads: int, number of threads to use for broker pattern

        :returns: list of tuples containing (account, container)
        """
        containers = []

        def publish(queue):
            for user, tenant_id in (rutils.iterate_per_tenants(
                    context.get("users", []))):
                context["tenants"][tenant_id]["containers"] = []
                for i in range(containers_per_tenant):
                    args = (user, context["tenants"][tenant_id]["containers"])
                    queue.append(args)

        def consume(cache, args):
            user, tenant_containers = args
            if user["id"] not in cache:
                cache[user["id"]] = swift_utils.SwiftScenario(
                    {"user": user, "task": context.get("task", {})})
            container_name = cache[user["id"]]._create_container()
            tenant_containers.append({"user": user,
                                      "container": container_name,
                                      "objects": []})
            containers.append((user["tenant_id"], container_name))

        broker.run(publish, consume, threads)

        return containers
dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/context/swift/utils.py/SwiftObjectMixin._create_containers/original