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


Python E.nonblocking_cmd方法代码示例

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


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

示例1: start_service

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import nonblocking_cmd [as 别名]
 def start_service(self, service):
   """
   Activates and starts the given service on the given machine
   """
   logging.info("ACTIVATE: %s service %s on %s" % (
     service, self.version_, self.machine_))
   cmd = E.nonblocking_cmd(
     "/etc/rc.d/init.d/%s_%s activate" % (service, self.version_))
   ret = E.exe("ssh %s %s" % (self.machine_, commands.mkarg(cmd)))
   if ret == 0:
     logging.info("START: %s service %s on %s" % (
         service, self.version_, self.machine_))
     cmd = E.nonblocking_cmd(
         "/etc/rc.d/init.d/%s_%s start" % (service, self.version_))
     ret = E.exe("ssh %s %s" % (self.machine_, commands.mkarg(cmd)))
   return ret
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:18,代码来源:install_manager.py

示例2: rebootwholeappliance

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import nonblocking_cmd [as 别名]
  def rebootwholeappliance(self):
    #reboot after a minute. On a cluster, reboot all other nodes first.
    cmd = E.nonblocking_cmd('shutdown -r +1 &')
    machines = self.cfg.getGlobalParam("MACHINES")
    logging.info("List of machines : %s" % machines)
    my_hostname=[]
    out = []
    E.execute(['localhost'],'hostname',my_hostname,E.true,1,0,self.cfg.getGlobalParam('ENTERPRISE_HOME'))
    logging.info('My hostname is : '+ str(my_hostname[0]) )
    #shallow copy is okay because list is not nested
    machines_other=machines[:]
    machines_other.remove(my_hostname[0])
    logging.info('Removed myself from the list of nodes because I will reboot myself at the end. List now is : '+ str(machines_other) )
    if len(machines_other) > 0 :
      E.execute(machines_other, cmd, out, E.true, 1, 0,self.cfg.getGlobalParam('ENTERPRISE_HOME'))
      logging.info('Output of command is : '+ str(out) )
      out = []
    else:
      logging.info('There are no other nodes. This must be a oneway')

    logging.info('Running the command on myself : '+ str(my_hostname) )
    E.execute(my_hostname, cmd, out, E.true, 1, 0,self.cfg.getGlobalParam('ENTERPRISE_HOME'))
    logging.info('Output of command is : '+ str(out) )

    return 0
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:27,代码来源:machine_handler.py


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