本文整理汇总了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")
示例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",
)
示例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")
示例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",
)
示例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",
)
示例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")
示例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")
示例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")
示例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")
示例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")
示例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")
示例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")
示例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")
示例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")
示例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")