• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python logger.LOG类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: _get_task_result_from_docker

    def _get_task_result_from_docker(self):
        cmd = 'docker exec -t {cid} /bin/sh -c ' \
              '"rally task results 2>/dev/null"'.format(cid=self.container_id)
        p = utils.run_cmd(cmd, quiet=True)

        try:
            return json.loads(p)[0]  # actual test result as a dictionary
        except ValueError:
            LOG.error("Gotten not-JSON object. Please see mcv-log")
            LOG.debug("Not-JSON object: %s, After command: %s", p, cmd)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:10,代码来源:runner.py


示例17: brew_a_report

def brew_a_report(stuff, name="mcv_result.html"):
    result = ""
    good, bad, notfound = 0, 0, 0
    location = name.rstrip("/index.html")
    for key, value in stuff.iteritems():
        if not validate_section(value):
            LOG.debug('Error: no results for %s' % key)
            continue
        res = ""
        for el in value['results']['test_success']:
            res += test_string % {"fontcolor": "green",
                                  "testname": el,
                                  "key": key}

            fix_dispatcher(key, "{loc}/{key}/{testname}.html".format(
                loc=location, testname=el, key=key))

            good += 1

        for el in value['results']['test_not_found']:
            res += test_string % {"fontcolor": "magenta",
                                  "testname": el,
                                  "key": key}

            fix_dispatcher(key, "{loc}/{key}/{testname}.html".format(
                loc=location, testname=el, key=key))

            notfound += 1

        for el in value['results']['test_failures']:
            res += test_string % {"fontcolor": "red",
                                  "testname": el,
                                  "key": key}

            fix_dispatcher(key, "{loc}/{key}/{testname}.html".format(
                loc=location, testname=el, key=key))

            bad += 1

        threshold = value['results'].get('threshold', '')
        if threshold:
            threshold = '(threshold is %s)' % threshold

        result += general_report % {"component_name": key,
                                    "component_list": res,
                                    "threshold": threshold}

    out = header % {
        "datetime_of_run": datetime.now().strftime("%a, %d %b %Y %H:%M:%S"),
        "quapla": str(good),
        "failure": str(bad)
    } + result + footer

    with open(name, "w") as f:
        f.write(out)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:55,代码来源:reporter.py


示例18: make_sure_controller_name_could_be_resolved

 def make_sure_controller_name_could_be_resolved(self):
     a_fqdn = self.os_data["auth_fqdn"]
     if a_fqdn:
         LOG.debug("FQDN is specified. Value=%s" % a_fqdn)
         f = open('/etc/hosts', 'a+r')
         for line in f.readlines():
             if line.find(a_fqdn) != -1:
                 return
         f.write(' '.join([self.os_data['ips']['endpoint'],
                 self.os_data['auth_fqdn'], "\n"]))
         f.close()
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:11,代码来源:router.py


示例19: prepare_tests

    def prepare_tests(self, test_group):
        section = "custom_test_group_" + test_group
        try:
            self.config.options(section)
        except NoSectionError:
            LOG.warning(("Test group {group} doesn't seem to exist "
                         "in config!").format(group=test_group))
            return {}

        out = dict([(opt, self.config.get(section, opt)) for opt in
                    self.config.options(section)])
        return out
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:12,代码来源:consoler.py


示例20: _setup_shaker_on_docker

 def _setup_shaker_on_docker(self):
     self.verify_container_is_up("shaker")
     self._check_shaker_setup()
     p = utils.run_cmd("docker ps")
     p = p.split('\n')
     for line in p:
         elements = line.split()
         if elements[1].find("shaker") != -1:
             self.container = elements[0]
             status = elements[4]
             LOG.debug('Container status: %s' % str(status))
             break
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:12,代码来源:runner.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python syslogger.Syslogger类代码示例发布时间:2022-05-27
下一篇:
Python mcstatus.MinecraftServer类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap