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

Python logger.info函数代码示例

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

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



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

示例1: download_release_resp

    def download_release_resp(cls, **kwargs):
        logger.info("RPC method download_release_resp received: %s" % jsonutils.dumps(kwargs))
        task_uuid = kwargs.get("task_uuid")
        error_msg = kwargs.get("error")
        status = kwargs.get("status")
        progress = kwargs.get("progress")

        task = objects.Task.get_by_uuid(task_uuid, fail_if_not_found=True)

        release_info = task.cache["args"]["release_info"]
        release_id = release_info["release_id"]
        release = db().query(Release).get(release_id)
        if not release:
            logger.error("download_release_resp: Release" " with ID %s not found", release_id)
            return

        if error_msg:
            status = "error"
            error_msg = "{0} download and preparation " "has failed.".format(release.name)
            cls._download_release_error(release_id, error_msg)
        elif progress == 100 and status == "ready":
            cls._download_release_completed(release_id)

        result = {"release_info": {"release_id": release_id}}

        data = {"status": status, "progress": progress, "message": error_msg, "result": result}
        objects.Task.update(task, data)
开发者ID:MoArif,项目名称:fuel-web,代码行数:27,代码来源:receiver.py


示例2: create

    def create(cls, data):
        topic = data.get("topic")
        node_id = data.get("node_id")
        task_uuid = data.pop("task_uuid", None)
        message = data.get("message")

        if topic == 'discover' and node_id is None:
            raise errors.CannotFindNodeIDForDiscovering(
                "No node id in discover notification"
            )

        if "datetime" not in data:
            data["datetime"] = datetime.now()

        task = None
        exist = None
        if task_uuid:
            task = Task.get_by_uuid(task_uuid)
            if task and node_id:
                exist = NotificationCollection.filter_by(
                    query=None,
                    node_id=node_id,
                    message=message,
                    task_id=task.id
                ).first()

        if not exist:
            super(Notification, cls).create(data)
            logger.info(
                u"Notification: topic: {0} message: {1}".format(
                    data.get("topic"),
                    data.get("message")
                )
            )
开发者ID:MsiRgb,项目名称:fuel-web,代码行数:34,代码来源:notification.py


示例3: PUT

    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 202 (environment reset initiated)
               * 400 (can't reset environment)
               * 404 (environment not found in db)
        """
        cluster = self.get_object_or_404(Cluster, cluster_id)

        try:
            logger.info(
                u"Trying to reset environment '{0}'".format(
                    cluster_id
                )
            )
            task_manager = ResetEnvironmentTaskManager(
                cluster_id=cluster.id
            )
            task = task_manager.execute()
        except Exception as exc:
            logger.warn(u'Error during execution '
                        u'environment resetting '
                        u'task: {0}'.format(str(exc)))
            raise web.badrequest(str(exc))

        raise web.webapi.HTTPError(
            status="202 Accepted",
            data=TaskHandler.render(task)
        )
开发者ID:tsipa,项目名称:fuel-web,代码行数:28,代码来源:cluster.py


示例4: assign_admin_ips

    def assign_admin_ips(cls, node_id, num=1):
        """Method for assigning admin IP addresses to nodes.

        :param node_id: Node database ID.
        :type  node_id: int
        :param num: Number of IP addresses for node.
        :type  num: int
        :returns: None
        """
        admin_net_id = cls.get_admin_network_group_id()
        node_admin_ips = db().query(IPAddr).filter_by(
            node=node_id,
            network=admin_net_id
        ).all()

        if not node_admin_ips or len(node_admin_ips) < num:
            admin_net = db().query(NetworkGroup).get(admin_net_id)
            logger.debug(
                u"Trying to assign admin ips: node=%s count=%s",
                node_id,
                num - len(node_admin_ips)
            )
            free_ips = cls.get_free_ips(
                admin_net.id,
                num=num - len(node_admin_ips)
            )
            logger.info(len(free_ips))
            for ip in free_ips:
                ip_db = IPAddr(
                    node=node_id,
                    ip_addr=ip,
                    network=admin_net_id
                )
                db().add(ip_db)
            db().commit()
开发者ID:teran,项目名称:fuel-web,代码行数:35,代码来源:manager.py


示例5: stats_user_resp

    def stats_user_resp(cls, **kwargs):
        logger.info("RPC method stats_user_resp received: %s",
                    jsonutils.dumps(kwargs))

        task_uuid = kwargs.get('task_uuid')
        nodes = kwargs.get('nodes', [])
        status = kwargs.get('status')
        error = kwargs.get('error')
        message = kwargs.get('msg')

        task = objects.Task.get_by_uuid(
            task_uuid, fail_if_not_found=True, lock_for_update=True)

        if status not in (consts.TASK_STATUSES.ready,
                          consts.TASK_STATUSES.error):
            logger.debug("Task %s, id: %s in status: %s",
                         task.name, task.id, task.status)
            return

        data = {'status': status, 'progress': 100, 'message': message}
        if status == consts.TASK_STATUSES.error:
            logger.error("Task %s, id: %s failed: %s",
                         task.name, task.id, error)
            data['message'] = error

        objects.Task.update(task, data)
        cls._update_action_log_entry(status, task.name, task_uuid, nodes)
        logger.info("RPC method stats_user_resp processed")
开发者ID:linglong0820,项目名称:fuel-web,代码行数:28,代码来源:receiver.py


示例6: set_proxy

def set_proxy(proxy):
    """Replace http_proxy environment variable for the scope
    of context execution. After exit from context old proxy value
    (if any) is restored

    :param proxy: - proxy url
    """
    variable_values = {
        'http_proxy': os.environ.get('http_proxy'),
        'https_proxy': os.environ.get('https_proxy')
    }
    for variable_name, variable_value in variable_values.items():
        if variable_value:
            logger.warning("{0} variable is already set with "
                           "value: {1}. Changing to {2}. Old value "
                           "will be restored after exit from script's "
                           "execution context"
                           .format(variable_name, variable_value, proxy))
        os.environ[variable_name] = proxy

    try:
        yield
    finally:
        for variable_name, variable_value in variable_values.items():
            if variable_value:
                logger.info("Restoring old value for http_proxy")
                os.environ[variable_name] = variable_value
            else:
                logger.info("Deleting set {0} environment variable"
                            .format(variable_name))
                del os.environ[variable_name]
开发者ID:SmartInfrastructures,项目名称:fuel-web-dev,代码行数:31,代码来源:utils.py


示例7: upload_fixtures

def upload_fixtures():
    # TODO(akislitsky): Temporary workaround for preventing uploading
    # fixtures on Fuel upgrade and container restart. We should remove
    # this after DB data upload will be switched from fixtures loading
    # to the the API calls.
    if db().query(models.Release).count():
        logger.info("Fixtures are already uploaded. Skipping")
        return

    fixtures_paths = get_all_fixtures_paths()
    for orig_path in settings.FIXTURES_TO_UPLOAD:
        if os.path.isabs(orig_path):
            path = orig_path
        else:
            for fixtures_path in fixtures_paths:
                path = os.path.abspath(
                    os.path.join(
                        fixtures_path,
                        orig_path
                    )
                )
                if os.access(path, os.R_OK):
                    break
        if os.access(path, os.R_OK):
            with open(path, "r") as fileobj:
                upload_fixture(fileobj)
            logger.info("Fixture has been uploaded from file: %s", path)
开发者ID:sebrandon1,项目名称:fuel-web,代码行数:27,代码来源:fixman.py


示例8: run

def run():
    logger.info("Starting standalone stats sender...")
    try:
        while True:
            StatsSender().send_stats_once()
    except (KeyboardInterrupt, SystemExit):
        logger.info("Stopping standalone stats sender...")
开发者ID:naveenzhang,项目名称:fuel-web,代码行数:7,代码来源:statsenderd.py


示例9: action_loadfakedeploymenttasks

def action_loadfakedeploymenttasks(params):
    from nailgun.db.sqlalchemy import fixman
    from nailgun.logger import logger

    logger.info("Applying fake deployment tasks to all releases...")
    fixman.load_fake_deployment_tasks()
    logger.info("Done")
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:7,代码来源:manage.py


示例10: send_action_log

    def send_action_log(self):
        action_log = db().query(models.ActionLog).order_by(
            models.ActionLog.id
        ).filter_by(
            is_sent=False
        ).limit(settings.STATS_SEND_COUNT)
        logger.info("Action log has %d unsent records", action_log.count())

        uid = InstallationInfo().get_master_node_uid()
        offset = 0
        while True:
            log_chunk = action_log.offset(offset)
            records = []
            ids = []
            logger.info("Send records: %s", six.text_type(log_chunk.count()))
            for log_record in log_chunk:
                body = objects.ActionLog.to_dict(log_record)
                record = {
                    'external_id': body['id'],
                    'master_node_uid': uid,
                    'body': body
                }
                records.append(record)
                ids.append(log_record.id)
            self.send_log_serialized(records, ids)
            if log_chunk.count() < settings.STATS_SEND_COUNT:
                break
            offset += settings.STATS_SEND_COUNT
开发者ID:naveenzhang,项目名称:fuel-web,代码行数:28,代码来源:statsenderd.py


示例11: send_oswl_serialized

 def send_oswl_serialized(self, rec_data, ids):
     if rec_data:
         resp = self.send_data_to_url(
             url=self.build_collector_url("COLLECTOR_OSWL_INFO_URL"),
             data={"oswl_stats": rec_data}
         )
         resp_dict = resp.json()
         if self.is_status_acceptable(resp.status_code,
                                      resp_dict["status"]):
             records_resp = resp_dict["oswl_stats"]
             status_failed = consts.LOG_RECORD_SEND_STATUS.failed
             saved_ids = set(r["id"] for r in records_resp
                             if r["status"] != status_failed)
             failed_ids = set(r["id"] for r in records_resp
                              if r["status"] == status_failed)
             sent_saved_ids = set(saved_ids) & set(ids)
             logger.info("OSWL info records saved: %s, failed: %s",
                         six.text_type(list(sent_saved_ids)),
                         six.text_type(list(failed_ids)))
             if sent_saved_ids:
                 db().query(models.OpenStackWorkloadStats).filter(
                     models.OpenStackWorkloadStats.id.in_(sent_saved_ids)
                 ).update(
                     {"is_sent": True}, synchronize_session=False
                 )
                 db().commit()
         else:
             logger.error("Unexpected collector answer: %s",
                          six.text_type(resp.text))
开发者ID:naveenzhang,项目名称:fuel-web,代码行数:29,代码来源:statsenderd.py


示例12: send_log_serialized

 def send_log_serialized(self, records, ids):
     if records:
         logger.info("Send %d action logs records", len(records))
         resp = self.send_data_to_url(
             url=self.build_collector_url("COLLECTOR_ACTION_LOGS_URL"),
             data={"action_logs": records}
         )
         resp_dict = resp.json()
         if self.is_status_acceptable(resp.status_code,
                                      resp_dict["status"]):
             records_resp = resp_dict["action_logs"]
             saved_ids = set()
             failed_ids = set()
             for record in records_resp:
                 if record["status"] == \
                         consts.LOG_RECORD_SEND_STATUS.failed:
                     failed_ids.add(record["external_id"])
                 else:
                     saved_ids.add(record["external_id"])
             sent_saved_ids = set(saved_ids) & set(ids)
             logger.info("Action logs records saved: %s, failed: %s",
                         six.text_type(list(sent_saved_ids)),
                         six.text_type(list(failed_ids)))
             db().query(models.ActionLog).filter(
                 models.ActionLog.id.in_(sent_saved_ids)
             ).update(
                 {"is_sent": True}, synchronize_session=False
             )
             db().commit()
         else:
             logger.error("Unexpected collector answer: %s",
                          six.text_type(resp.text))
开发者ID:cxb811201,项目名称:fuel-web,代码行数:32,代码来源:statsenderd.py


示例13: run

def run():
    logger.info("Starting standalone stats sender...")
    try:
        StatsSender().run()
    except (KeyboardInterrupt, SystemExit) as e:
        logger.error("Stats sender exception: %s", six.text_type(e))
    logger.info("Stopping standalone stats sender...")
开发者ID:cxb811201,项目名称:fuel-web,代码行数:7,代码来源:statsenderd.py


示例14: _check_vmware_consistency

    def _check_vmware_consistency(cls, task):
        """Checks vmware attributes consistency and proper values
        """
        attributes = task.cluster.attributes.editable
        vmware_attributes = task.cluster.vmware_attributes
        # Old(< 6.1) clusters haven't vmware support
        if vmware_attributes:
            cinder_nodes = filter(
                lambda node: 'cinder' in node.all_roles,
                task.cluster.nodes)

            if not cinder_nodes:
                logger.info('There is no any node with "cinder" role provided')

            models = {
                'settings': attributes,
                'default': vmware_attributes.editable,
                'cluster': task.cluster,
                'version': settings.VERSION,
                'networking_parameters': task.cluster.network_config
            }

            errors_msg = VmwareAttributesRestriction.check_data(
                models=models,
                metadata=vmware_attributes.editable['metadata'],
                data=vmware_attributes.editable['value'])

            if errors_msg:
                raise errors.CheckBeforeDeploymentError('\n'.join(errors_msg))
开发者ID:vefimova,项目名称:fuel-web,代码行数:29,代码来源:task.py


示例15: run

def run():
    logger.info("Starting standalone RPC consumer...")
    with Connection(rpc.conn_str) as conn:
        try:
            RPCConsumer(conn, NailgunReceiver).run()
        except (KeyboardInterrupt, SystemExit):
            logger.info("Stopping standalone RPC consumer...")
开发者ID:Axam,项目名称:nsx-web,代码行数:7,代码来源:receiverd.py


示例16: action_syncdb

def action_syncdb(params):
    from nailgun.db import syncdb
    from nailgun.logger import logger

    logger.info("Syncing database...")
    syncdb()
    logger.info("Done")
开发者ID:sirmax123,项目名称:fuel-web,代码行数:7,代码来源:manage.py


示例17: provision_resp

    def provision_resp(cls, **kwargs):
        logger.info(
            "RPC method provision_resp received: %s" %
            json.dumps(kwargs))

        task_uuid = kwargs.get('task_uuid')
        message = kwargs.get('error')
        status = kwargs.get('status')
        progress = kwargs.get('progress')
        nodes = kwargs.get('nodes', [])

        task = get_task_by_uuid(task_uuid)

        for node in nodes:
            uid = node.get('uid')
            node_db = db().query(Node).get(uid)

            if not node_db:
                logger.warn('Task with uid "{0}" not found'.format(uid))
                continue

            if node.get('status') == 'error':
                node_db.status = 'error'
                node_db.progress = 100
                node_db.error_type = 'provision'
                node_db.error_msg = node.get('error_msg', 'Unknown error')
            else:
                node_db.status = node.get('status')
                node_db.progress = node.get('progress')

        TaskHelper.update_task_status(task.uuid, status, progress, message)
开发者ID:adanin,项目名称:fuel-web,代码行数:31,代码来源:receiver.py


示例18: action_loaddefault

def action_loaddefault(params):
    from nailgun.db.sqlalchemy import fixman
    from nailgun.logger import logger

    logger.info("Uploading fixture...")
    fixman.upload_fixtures()
    logger.info("Done")
开发者ID:MsiRgb,项目名称:fuel-web,代码行数:7,代码来源:manage.py


示例19: update_task_status

    def update_task_status(cls, uuid, status, progress, msg="", result=None):
        # verify_networks - task is expecting to receive result with
        # some data if connectivity_verification fails
        logger.debug("Updating task: %s", uuid)
        task = db().query(Task).filter_by(uuid=uuid).first()
        if not task:
            logger.error("Can't set status='%s', message='%s':no task \
                    with UUID %s found!", status, msg, uuid)
            return
        previous_status = task.status
        data = {'status': status, 'progress': progress,
                'message': msg, 'result': result}
        for key, value in data.iteritems():
            if value is not None:
                setattr(task, key, value)
                logger.info(
                    u"Task {0} ({1}) {2} is set to {3}".format(
                        task.uuid,
                        task.name,
                        key,
                        value
                    )
                )
        db().add(task)
        db().commit()

        if previous_status != status and task.cluster_id:
            logger.debug("Updating cluster status: "
                         "cluster_id: %s status: %s",
                         task.cluster_id, status)
            cls.update_cluster_status(uuid)
        if task.parent:
            logger.debug("Updating parent task: %s.", task.parent.uuid)
            cls.update_parent_task(task.parent.uuid)
开发者ID:loles,项目名称:fuelweb,代码行数:34,代码来源:helpers.py


示例20: action_syncdb

def action_syncdb(params):
    from nailgun.db.migration import do_upgrade_head
    from nailgun.logger import logger

    logger.info("Syncing database...")
    do_upgrade_head()
    logger.info("Done")
开发者ID:MsiRgb,项目名称:fuel-web,代码行数:7,代码来源:manage.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python logger.warn函数代码示例发布时间:2022-05-27
下一篇:
Python logger.exception函数代码示例发布时间: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