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


Python InstanceManager.getInstance方法代码示例

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


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

示例1: __prepare

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
    def __prepare(self):
        self.log.debug("initiating preparation")

        # create the spool directory
        self.__spool = self.__createSpool()

        # create the instance
        self.__inst = InstanceManager.getInstance().newInstance(self.__spool)
        self.__inst.task = self

        from xbe.xbed.task_activities import SetUpActivity, AcquireResourceActivity
        from xbe.util.activity import ComplexActivity, ThreadedActivity

        mac_pool = XBEDaemon.getInstance().macAddresses
        jail_package = XBEDaemon.getInstance().opts.jail_package
        mac_acquirer = ThreadedActivity(
            AcquireResourceActivity(mac_pool))
        setup_activity = ThreadedActivity(
            SetUpActivity(self.__spool, jail_package), (self.__jsdl_doc, self.__activity_logs["stage-in"]))

        complex_activity = ComplexActivity([setup_activity, mac_acquirer])
        self.mgr.registerActivity(self, complex_activity,
                                  on_finish=self._cb_stage_in_succeed,
                                  on_fail=self._eb_stage_in_failed,
                                  on_abort=None)
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:27,代码来源:task.py

示例2: do_InstanceAlive

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
 def do_InstanceAlive(self, xml, *a, **kw):
     msg = message.MessageBuilder.from_xml(xml.getroottree())
     inst_id = msg.inst_id()
     inst = InstanceManager.getInstance().lookupByUUID(msg.inst_id())
     if inst is not None:
         inst.update_alive()
     else:
         log.warn("got alive message from suspicious source")
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:10,代码来源:proto.py

示例3: do_life_sign

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
	  def do_life_sign(self, life_sign):
		  self.log.debug("instance %s is alive", self._instanceID)
		  inst = InstanceManager.getInstance().lookupByUUID(self._instanceID)
		  if inst is not None:
			  inst.life_sign(self, life_sign)
		  else:
			  self.log.warn("unknown instance: %s", self._instanceID)
			  self.requestShutdown(None, None)
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:10,代码来源:proto.py

示例4: do_InstanceAvailable

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
    def do_InstanceAvailable(self, xml, *args, **kw):
        inst_avail = message.MessageBuilder.from_xml(xml.getroottree())
        inst_id = inst_avail.inst_id()

        inst = InstanceManager.getInstance().lookupByUUID(inst_id)
        if inst is not None:
            inst.available(self)
        else:
            log.warn("got available message from suspicious source")
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:11,代码来源:proto.py

示例5: do_ExecutionFailed

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
 def do_ExecutionFailed(self, xml, *a, **kw):
     msg = message.MessageBuilder.from_xml(xml.getroottree())
     inst_id = msg.inst_id()
     inst = InstanceManager.getInstance().lookupByUUID(inst_id)
     if inst is not None:
         log.debug("execution on instance %s failed: %s" % (inst_id, msg.reason()))
         try:
             inst.task.signalExecutionFailed(Exception("execution failed", msg))
         except Exception, e:
             log.warn("could not signal execution failure: %s" % e)
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:12,代码来源:proto.py

示例6: do_InstanceShuttingDown

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
 def do_InstanceShuttingDown(self, xml, *a, **kw):
     msg = message.MessageBuilder.from_xml(xml.getroottree())
     inst_id = msg.inst_id()
     inst = InstanceManager.getInstance().lookupByUUID(inst_id)
     if inst is not None:
         log.info("instance is shutting down...")
         log.debug("execution on instance %s finished" % inst_id)
         try:
             inst.task.signalExecutionEnd(0)
         except Exception, e:
             log.warn("could not signal execution end: %s" % e)
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:13,代码来源:proto.py

示例7: do_ExecutionFinished

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
 def do_ExecutionFinished(self, xml, *args, **kw):
     msg = message.MessageBuilder.from_xml(xml.getroottree())
     inst_id = msg.inst_id()
     exitcode = msg.exitcode()
     inst = InstanceManager.getInstance().lookupByUUID(inst_id)
     if inst is not None:
         log.debug("execution on instance %s finished" % inst_id)
         try:
             inst.task.signalExecutionEnd(exitcode)
         except Exception, e:
             log.warn("could not signal execution end: %s" % e)
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:13,代码来源:proto.py

示例8: do_failed

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
	  def do_failed(self, failed):
		  self.log.info("execution on instance has failed: %d", failed.reason)
		  # send a failed ack to the instance
		  ack = xbemsg.XbeMessage()
		  ack.header.conversation_id = self._conv_id
		  ack.failed_ack.task = failed.task

		  inst = InstanceManager.getInstance().lookupByUUID(self._instanceID)
		  if inst is not None:
			  inst.task.signalExecutionFailed(failed.reason)
		  return ack
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:13,代码来源:proto.py

示例9: __delete_instance

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
 def __delete_instance(self, *a, **kw):
     InstanceManager.getInstance().removeInstance(self.__inst)
     del self.__inst.task
     del self.__inst
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:6,代码来源:task.py

示例10: do_status

# 需要导入模块: from xbe.xbed.instance import InstanceManager [as 别名]
# 或者: from xbe.xbed.instance.InstanceManager import getInstance [as 别名]
	  def do_status(self, status):
		  self.log.info("received status information: %s", status)

		  inst = InstanceManager.getInstance().lookupByUUID(self._instanceID)
		  if inst is not None:
			  inst.task.signalStatus(status)
开发者ID:BackupTheBerlios,项目名称:xenbee-svn,代码行数:8,代码来源:proto.py


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