当前位置: 首页>>代码示例>>Python>>正文


Python logger.LOG类代码示例

本文整理汇总了Python中mcv_consoler.logger.LOG的典型用法代码示例。如果您正苦于以下问题:Python LOG类的具体用法?Python LOG怎么用?Python LOG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LOG类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_floating_ips

 def delete_floating_ips(self):
     LOG.debug("Removing created floating IPs")
     for floating_ip in self.fresh_floating_ips:
         try:
             floating_ip.delete()
         except Exception as e:
             LOG.debug("Error removing floating IP: %s" % e.message)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:7,代码来源:router.py

示例2: check_and_fix_access_data

    def check_and_fix_access_data(self):
        if not self.verify_access_data_is_set():
            return False

        LOG.debug("Trying to authenticate with OpenStack "
                  "using provided credentials...")
        self.make_sure_controller_name_could_be_resolved()
        try:
            self.novaclient.authenticate()
        except nexc.ConnectionRefused:
            LOG.error("Apparently authentication endpoint address is invalid."
                      " Current value is %s" % self.os_data["ips"]["endpoint"])
            return False
        except nexc.Unauthorized:
            LOG.error("Apparently OS user credentials are incorrect.\n"
                      "Current os-username is: %s\n"
                      "Current os-password is: %s \n"
                      "Current os-tenant is: %s \n"
                      % (self.os_data["username"],
                         self.os_data["password"],
                         self.os_data["tenant_name"]
                         ))
            return False
        except (Timeout, ConnectionError) as conn_e:
            LOG.error("Apparently auth endpoint address is not valid."
                      " %s" % str(conn_e))
            return False
        LOG.debug("Access data looks valid.")
        return True
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:29,代码来源:router.py

示例3: generate_report

    def generate_report(self, spd_res):
        path = os.path.join(os.path.dirname(__file__), 'speed_template.html')
        temp = open(path, 'r')
        template = temp.read()
        temp.close()
        html_res = ''
        avg_spds = []

        for test_node, spd in spd_res.iteritems():
            html_res += (
                '<tr><td align="center">Network speed to node '
                '{}:</td><tr>\n').format(test_node)

            # Calculate speed from time
            spd = [float(self.data_size) / i for i in spd]

            for i in range(len(spd)):
                html_res += ('<tr><td>{} attempt:</td><td align="right">Speed '
                             '{} MB/s</td><tr>\n').format(i + 1,
                                                          round(spd[i], 2))

            avg_spd = round(sum(spd) / float(len(spd)), 2)
            html_res += (
                '<tr><td align="center">Average speed: {} '
                'MB/s</td><tr>\n').format(avg_spd)
            avg_spds.append(avg_spd)

        total_avg_spd = round(sum(avg_spds) / float(len(avg_spds)), 2)
        LOG.info("Node %s average network speed: %s MB/s \n" % (
            self.node_name, total_avg_spd))
        return template.format(node_name=self.node_name,
                               attempts=html_res,
                               avg=total_avg_spd), total_avg_spd
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:33,代码来源:speed_tester.py

示例4: _validate_test_params

 def _validate_test_params(self, **params):
     for key in 'compute', 'concurrency':
         if key not in params:
             continue
         if not isinstance(params[key], int):
             LOG.warning("Type mismatch. Parameter '%s' expected to be "
                         "an %s. Got: %s" % (key, int, type(key)))
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:7,代码来源:runner.py

示例5: start_container

    def start_container(self):
        LOG.debug("Bringing up Shaker container with credentials")

        add_host = ""

        # TODO(albartash): Refactor this place!
        if self.config.get("auth", "auth_fqdn") != '':
            add_host = "--add-host={fqdn}:{endpoint}".format(
                fqdn=self.access_data["auth_fqdn"],
                endpoint=self.access_data["ips"]["endpoint"])

        network_name = utils.GET(
            self.config, 'network_ext_name', 'network_speed') or ""

        res = subprocess.Popen(
            ["docker", "run", "-d", "-P=true"] +
            [add_host] * (add_host != "") +
            ["-p", "5999:5999",
             "-e", "OS_AUTH_URL=" + self.access_data["auth_url"],
             "-e", "OS_TENANT_NAME=" + self.access_data["tenant_name"],
             "-e", "OS_USERNAME=" + self.access_data["username"],
             "-e", "OS_PASSWORD=" + self.access_data["password"],
             "-e", "OS_REGION_NAME=" + self.access_data["region_name"],
             "-e", "SHAKER_EXTERNAL_NET=" + str(network_name),
             "-e", "KEYSTONE_ENDPOINT_TYPE=publicUrl",
             "-e", "OS_INSECURE=" + str(self.access_data["insecure"]),
             # TODO(vokhrimenko): temporarily not used
             #"-e", "OS_CACERT=" + self.access_data["fuel"]["ca_cert"],
             "-v", "%s:%s" % (self.homedir, self.home), "-w", self.home,
             "-t", "mcv-shaker"],
            stdout=subprocess.PIPE,
            preexec_fn=utils.ignore_sigint).stdout.read()

        LOG.debug('Finish bringing up Shaker container. '
                  'ID = %s' % str(res))
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:35,代码来源:runner.py

示例6: create_sahara_image

    def create_sahara_image(self, mos_version):
        try:
            sahara = Clients.get_sahara_client(self.access_data)
        except k_exc.EndpointNotFound:
            LOG.warning("Can't run BigData workload task without installed sahara")
            self.skip = True
            return
        i_list = self.glanceclient.images.list()
        for im in i_list:
            if im.name == 'mcv-workload-sahara':
                return im.id
        if mos_version == '8.0':
            sahara_image_path = SAHARA_IMAGE_PATH80
        else:
            sahara_image_path = SAHARA_IMAGE_PATH70
        im = self.glanceclient.images.create(name='mcv-workload-sahara',
                                             disk_format="qcow2",
                                             is_public=True,
                                             container_format="bare",
                                             data=open(sahara_image_path))
        sahara.images.update_image(
            image_id=im.id, user_name='ubuntu', desc="")
        if mos_version == '8.0':
            sahara.images.update_tags(
                image_id=im.id, new_tags=["vanilla", "2.7.1"])
        else:
            sahara.images.update_tags(
                image_id=im.id, new_tags=["vanilla", "2.6.0"])

        return im.id
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:30,代码来源:runner.py

示例7: init_clients

 def init_clients(self, access_data):
     LOG.debug("Trying to obtain authenticated OS clients")
     self.novaclient = Clients.get_nova_client(access_data)
     self.cinderclient = Clients.get_cinder_client(access_data)
     self.glanceclient = Clients.get_glance_client(access_data)
     self.neutronclient = Clients.get_neutron_client(access_data)
     LOG.debug("Finish obtaining OS clients.")
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:7,代码来源:resource_reporter.py

示例8: _run_rally

    def _run_rally(self, task):
        LOG.debug("Running task %s" % task)
        # warning: at this point task must be transformed to a full path
        path_to_task = self._get_task_path(task)
        p = utils.run_cmd("rally task start " + path_to_task)

        out = p.split('\n')[-4].lstrip('\t')
        return out
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:8,代码来源:runner.py

示例9: clear_shaker

 def clear_shaker(self):
     cleanup = utils.GET(self.config, 'cleanup', 'shaker') or 'True'
     if cleanup == 'True':
         LOG.info("Removing shaker's image and flavor")
         cmd = "docker exec -t %s shaker-cleanup --image-name %s " \
           "--flavor-name %s" % (self.container_id, self.image_name,
                                 self.flavor_name)
         utils.run_cmd(cmd)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:8,代码来源:runner.py

示例10: check_computes

 def check_computes(self):
     # TODO(albartash): Do we really need this method?
     services = self.novaclient.services.list()
     self.compute = 0
     for service in services:
         if service.binary == 'nova-compute':
             self.compute += 1
     LOG.debug("Found " + str(self.compute) + " computes.")
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:8,代码来源:runner.py

示例11: generate_report

    def generate_report(self, html, task):

        # TODO(ekudryashova): Append last run to existing file for now.
        # Not sure how to fix this properly

        LOG.debug('Generating report in resources.html file')
        report = file('%s/%s.html' % (self.path, task), 'w')
        report.write(html)
        report.close()
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:9,代码来源:runner.py

示例12: run_batch

 def run_batch(self, tasks, *args, **kwargs):
     LOG.info("Time start: %s UTC\n" % str(datetime.datetime.utcnow()))
     self._setup_rally_on_docker()
     result = super(RallyRunner, self).run_batch(tasks, *args, **kwargs)
     self.cleanup_fedora_image()
     self.cleanup_test_flavor()
     self.cleanup_network()
     LOG.info("Time end: %s UTC" % str(datetime.datetime.utcnow()))
     return result
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:9,代码来源:runner.py

示例13: fix_shaker

 def fix_shaker(file_location):
     LOG.debug('Fixing Shaker report')
     if not os.path.isfile(file_location):
         return LOG.debug('File not found %s' % file_location)
     cmd = ("sed -i '/<div\ class=\"container\"\ id=\"container\">/"
            " a\  <li class=\"active\" style=\"list-style-type: none;\"><a "
            "href=\"../index.html\">Back to Index</a></li>' "
            "%s" % file_location)
     utils.run_cmd(cmd)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:9,代码来源:reporter.py

示例14: _run_shaker

    def _run_shaker(self, task):
        LOG.debug("Running task %s" % task)
        # warning: at this point task must be transformed to a full path
        path_to_task = self._get_task_path(task)
        p = utils.run_cmd("rally task start " + path_to_task)

        # here out is in fact a command which can be run to obtain task results
        # thus it is returned directly.
        out = p.split('\n')[-4].lstrip('\t')
        return out
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:10,代码来源:runner.py

示例15: validate_conf

def validate_conf(config, run_args):
    cv = ConfigValidator(config, run_args)
    LOG.debug('Validating config: %s' % cv.conf_path)
    cv.validate()
    all_good = cv.status
    if all_good:
        LOG.debug('Config looks fine')
    else:
        cv.format_errors()
    return all_good
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:10,代码来源:conf_validation.py


注:本文中的mcv_consoler.logger.LOG类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。