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


Python LOG.warning方法代码示例

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


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

示例1: _validate_test_params

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 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,代码行数:9,代码来源:runner.py

示例2: run_individual_task

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 def run_individual_task(self, task, *args, **kwargs):
     try:
         task_failed = self._run_rally_on_docker(task, *args, **kwargs)
     except subprocess.CalledProcessError as e:
         LOG.error("Task %s has failed with: %s" % (task, e))
         self.test_failures.append(task)
         LOG.info(" * FAILED")
         return False
     if task_failed is True:
         LOG.warning("Task %s has failed for some "
                     "instrumental issues" % task)
         self.test_failures.append(task)
         LOG.info(" * FAILED")
         return False
     elif self.skip:
         LOG.debug("Skipped test %s" % task)
         LOG.info(" * SKIPPED")
         return False
     LOG.debug("Retrieving task results for %s" % task)
     task_result = self._get_task_result_from_docker()
     if task_result is None:
         self.test_failures.append(task)
         LOG.info(" * FAILED")
         return False
     return self._evaluate_task_result(task, task_result)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:27,代码来源:runner.py

示例3: create_sahara_image

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
    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,代码行数:32,代码来源:runner.py

示例4: format_errors

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 def format_errors(self):
     for err_msg in self.errors:
         LOG.error(err_msg)
     if self.missing:
         LOG.error(self.t_missing_header.format(conf=self.conf_path))
     for msg in self.missing:
         LOG.warning(msg)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:9,代码来源:conf_validation.py

示例5: _evaluate_task_result

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
    def _evaluate_task_result(self, task, resulting_dict):
        status = True
        errors = ''
        if type(resulting_dict) != dict:
            LOG.debug("Task %s has failed with the following error: %s" %
                      (task, resulting_dict))
            return False
        if resulting_dict == []:
            errors = 'Timeout Error with shaker. Process was killed.'
            LOG.warning("Task %s has failed with the following error: %s" %
                        (task, errors))
            return False

        for i in resulting_dict['records']:
            try:
                if resulting_dict['records'][i]['status'] == 'error':
                    status = False
                    errors += '\n' + resulting_dict['records'][i]['stderr']
            except KeyError:
                pass

        if status:
            LOG.debug("Task %s has completed successfully." % task)
        else:
            LOG.warning("Task %s has failed with the following error: %s" %
                        (task, errors))
            return status
        return status
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:30,代码来源:runner.py

示例6: _evaluate_task_results

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 def _evaluate_task_results(self, task_results):
     res = True
     for speed in task_results:
         if speed < float(self.threshold):
             res = False
             LOG.warning('Average speed is under the threshold')
             LOG.info(" * FAILED")
             break
         else:
             LOG.info(" * PASSED")
     return res
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:13,代码来源:runner.py

示例7: prepare_tests

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
    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,代码行数:14,代码来源:consoler.py

示例8: check_config_strusture

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 def check_config_strusture(self, group):
     section_opts = self.get_custom_section_items(group)
     if not section_opts:
         return
     for tool, tests in section_opts:
         if tool not in self._runners:
             continue
         no_comma = re.findall(RE_TESTS_WITHOUT_COMMA, tests)
         bad_yamls = re.findall(RE_YAMLS_WITHOUT_COMMA, tests)
         for t in no_comma + bad_yamls:
             msg = self.line_printer.get_pretty(t)
             LOG.warning('Warning: ' + msg)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:14,代码来源:conf_validation.py

示例9: check_and_fix_floating_ips

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
    def check_and_fix_floating_ips(self):
        res = self.novaclient.floating_ips.list()
        if len(res) >= 2:
            LOG.debug("Apparently there is enough floating ips")
        else:
            LOG.info("Need to create a floating ip")
            try:
                self.fresh_floating_ips.append(
                    self.novaclient.floating_ips.create())
            except Exception as ip_e:
                LOG.warning("Apparently the cloud is out of free floating ip. "
                            "You might experience problems "
                            "with running some tests")
                LOG.debug("Error creating floating IP - %s" % str(ip_e))

                return
            return self.check_and_fix_floating_ips()
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:19,代码来源:router.py

示例10: check_docker_images

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
    def check_docker_images(self):
        LOG.debug('Validating that all docker images required by '
                  'the application are available')

        sleep_total = 0
        sleep_for = app_conf.DOCKER_CHECK_INTERVAL
        timeout = app_conf.DOCKER_LOADING_IMAGE_TIMEOUT

        while True:
            if self.event.is_set():
                LOG.warning('Caught Keyboard Interrupt, exiting')
                return False

            if sleep_total >= timeout:
                LOG.warning('Failed to load one or more docker images. '
                            'Gave up after %s seconds. See log for more '
                            'details' % sleep_total)
                return False

            res = utils.run_cmd("docker images --format {{.Repository}}",
                                quiet=True)

            all_present = all(map(res.count, app_conf.DOCKER_REQUIRED_IMAGES))
            if all_present:
                LOG.debug("All docker images seem to be in place")
                return True

            by_name = lambda img: res.count(img) == 0
            not_found = filter(by_name, app_conf.DOCKER_REQUIRED_IMAGES)

            formatter = dict(
                sleep=sleep_for, total=sleep_total,
                max=timeout, left=timeout - sleep_total
            )
            LOG.debug('One or more docker images are not present: '
                      '{missing}.'.format(missing=', '.join(not_found)))
            LOG.debug('Going to wait {sleep} more seconds for them to load. '
                      'ETA: already waiting {total} sec; max time {max}; '
                      '{left} left'.format(**formatter))

            time.sleep(sleep_for)
            sleep_total += sleep_for
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:44,代码来源:accessor.py

示例11: _do_finalization

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
    def _do_finalization(self, run_results):
        if run_results is None:
            LOG.warning("For some reason test tools have returned nothing")
            return

        self.describe_results(run_results)
        self.update_config(run_results)
        try:
            reporter.brew_a_report(run_results,
                                   self.results_vault + "/index.html")
        except Exception as e:
            LOG.warning("Brewing a report has failed with error: %s" % str(e))
            LOG.debug(traceback.format_exc())
            return

        result_dict = {
            "timestamp": self.timestamp_str,
            "location": self.results_vault
        }

        LOG.debug('Creating a .tar.gz archive with test reports')
        try:
            cmd = ("tar -zcf /tmp/mcv_run_%(timestamp)s.tar.gz"
                   " -C %(location)s .") % result_dict
            utils.run_cmd(cmd)

            cmd = "rm -rf %(location)s" % {"location": self.results_vault}
            utils.run_cmd(cmd)
        except subprocess.CalledProcessError:
            LOG.warning('Creation of .tar.gz archive has failed. See log '
                        'for details. You can still get your files from: '
                        '%s' % self.results_vault)
            LOG.debug(traceback.format_exc())
            return

        LOG.debug("Finished creating a report.")
        LOG.info("One page report could be found in "
                     "/tmp/mcv_run_%(timestamp)s.tar.gz\n" % result_dict)

        return result_dict
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:42,代码来源:consoler.py

示例12: do_custom

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 def do_custom(self, test_group):
     LOG.warning('Deprecation Warning: Tests is running, but the command is obsolete.'
                 ' Please use command "... --run group ..." instead.')
     return self.do_group(test_group)
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:6,代码来源:consoler.py

示例13: check_and_fix_environment

# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import warning [as 别名]
 def check_and_fix_environment(self):
     if not self.check_docker_images():
         LOG.warning('Failed to load docker images. Exiting')
         return False
     return self.router.setup_connections()
开发者ID:mcloudv,项目名称:mcv-consoler,代码行数:7,代码来源:accessor.py


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