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


Python events.emit函数代码示例

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


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

示例1: reassign

    def reassign():
        # NOTE(akscram): Initialization of fuelclient.
        fuel_config = flask.current_app.config["CLOUDS"]["fuel"]["endpoint"]
        os.environ["SERVER_ADDRESS"] = fuel_config["host"]
        os.environ["LISTEN_PORT"] = str(fuel_config["port"])
        os.environ["KEYSTONE_USER"] = fuel_config["username"]
        os.environ["KEYSTONE_PASS"] = fuel_config["password"]

        src_config = hooks.source.config()
        dst_config = hooks.destination.config()
        config = {
            "source": src_config["environment"],
            "destination": dst_config["environment"],
        }

        try:
            src = hooks.source.connect()
            dst = hooks.destination.connect()
            ctx = context.Context(config, src, dst)

            flow = node_tasks.reassign_node(ctx, host_id)
            LOG.debug("Reassigning flow: %s", flow)
            result = flows.run_flow(flow, ctx.store)
            LOG.debug("Result of migration: %s", result)
        except Exception:
            msg = ("Error is occured during reassigning host {}"
                   .format(host_id))
            LOG.exception(msg)
            events.emit("error", {
                "message": msg,
            }, namespace="/events")
开发者ID:UshF,项目名称:pumphouse,代码行数:31,代码来源:handlers.py

示例2: created_event

 def created_event(self, flavor):
     LOG.info("Flavor created: %s", flavor.id)
     events.emit(
         "create",
         {"id": flavor.id, "type": "flavor", "cloud": self.cloud.name, "data": flavor.to_dict()},
         namespace="/events",
     )
开发者ID:pombredanne,项目名称:pumphouse,代码行数:7,代码来源:flavor.py

示例3: unassign_start_event

 def unassign_start_event(self, node):
     events.emit("update", {
         "id": extract_hostname(node.data),
         "cloud": self.cloud.name,
         "type": "host",
         "action": "reassignment",
     }, namespace="/events")
开发者ID:UshF,项目名称:pumphouse,代码行数:7,代码来源:node.py

示例4: delete_event

 def delete_event(self, keypair_info):
     LOG.info("Deleted keypair: %s", keypair_info["name"])
     events.emit(
         "delete",
         {"id": keypair_info["name"], "type": "keypair", "cloud": self.cloud.name, "data": None},
         namespace="/events",
     )
开发者ID:pombredanne,项目名称:pumphouse,代码行数:7,代码来源:keypair.py

示例5: create_event

 def create_event(self, keypair):
     LOG.info("Created keypair: %s", keypair.name)
     events.emit(
         "create",
         {"id": keypair.name, "type": "keypair", "cloud": self.cloud.name, "data": keypair.to_dict()},
         namespace="/events",
     )
开发者ID:pombredanne,项目名称:pumphouse,代码行数:7,代码来源:keypair.py

示例6: created_event

 def created_event(self, secgroup_info):
     events.emit("create", {
         "id": secgroup_info["id"],
         "type": "secgroup",
         "cloud": self.cloud.name,
         "data": secgroup_info,
     }, namespace="/events")
开发者ID:pombredanne,项目名称:pumphouse,代码行数:7,代码来源:secgroup.py

示例7: upload_to_glance_event

 def upload_to_glance_event(self, image_info):
     LOG.info("Created: %s", image_info)
     events.emit("create", {
         "id": image_info["id"],
         "cloud": self.cloud.name,
         "type": "image",
         "data": dict(image_info)
     }, namespace="/events")
开发者ID:rmoe,项目名称:pumphouse,代码行数:8,代码来源:volume.py

示例8: upload_to_glance_event

 def upload_to_glance_event(self, image_info):
     LOG.info("Created: %s", image_info)
     events.emit("volume snapshot create", {
         "cloud": self.cloud.name,
         "id": image_info["id"],
         "name": image_info["name"],
         "status": "active",
     }, namespace="/events")
开发者ID:UshF,项目名称:pumphouse,代码行数:8,代码来源:volume.py

示例9: created_event

 def created_event(self, floating_ip):
     events.emit("create", {
         "id": floating_ip.address,
         "type": "floating_ip",
         "cloud": self.cloud.name,
         "data": dict(floating_ip.to_dict(),
                      name=floating_ip.address),
     }, namespace="/events")
开发者ID:UshF,项目名称:pumphouse,代码行数:8,代码来源:floating_ip.py

示例10: update_event

 def update_event(self, service):
     events.emit("update", {
         "id": service["host"],
         "cloud": self.cloud.name,
         "type": "host",
         "progress": None,
         "action": None,
     }, namespace="/events")
开发者ID:UshF,项目名称:pumphouse,代码行数:8,代码来源:node.py

示例11: resume_event

 def resume_event(self, server):
     LOG.info("Server resumed: %s", server["id"])
     events.emit("update", {
         "id": server["id"],
         "cloud": self.cloud.name,
         "type": "server",
         "data": server,
     }, namespace="/events")
开发者ID:rmoe,项目名称:pumphouse,代码行数:8,代码来源:server.py

示例12: execute

 def execute(self, server_id):
     LOG.info("Migration of server %r started", server_id)
     events.emit("update", {
         "id": server_id,
         "cloud": self.cloud.name,
         "type": "server",
         "action": "migration",
     }, namespace="/events")
开发者ID:rmoe,项目名称:pumphouse,代码行数:8,代码来源:server.py

示例13: created_event

 def created_event(self, tenant):
     LOG.info("Tenant created: %s", tenant.id)
     events.emit("create", {
         "id": tenant.id,
         "type": "tenant",
         "cloud": self.cloud.name,
         "data": tenant.to_dict(),
     }, namespace="/events")
开发者ID:pombredanne,项目名称:pumphouse,代码行数:8,代码来源:tenant.py

示例14: created_event

 def created_event(self, snapshot):
     events.emit("create", {
         "id": snapshot["id"],
         "type": "image",
         "cloud": self.cloud.name,
         "action": "uploading",
         "data": dict(snapshot),
     }, namespace="/events")
开发者ID:pombredanne,项目名称:pumphouse,代码行数:8,代码来源:snapshot.py

示例15: created_event

 def created_event(self, user):
     LOG.info("Created user: %s", user)
     events.emit("create", {
         "id": user.id,
         "type": "user",
         "cloud": self.cloud.name,
         "data": user.to_dict(),
     }, namespace="/events")
开发者ID:pombredanne,项目名称:pumphouse,代码行数:8,代码来源:user.py


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