コード例 #1
0
ファイル: utils.py プロジェクト: OpenPOWER-BigData/HDP-ambari
def safe_zkfc_op(action, env):
  """
  Idempotent operation on the zkfc process to either start or stop it.
  :param action: start or stop
  :param env: environment
  """
  Logger.info("Performing action {0} on zkfc.".format(action))
  zkfc = None
  if action == "start":
    try:
      zkfc = ZkfcSlave()
      zkfc.status(env)
    except ComponentIsNotRunning:
      if zkfc:
        zkfc.start(env)

  if action == "stop":
    try:
      zkfc = ZkfcSlave()
      zkfc.status(env)
    except ComponentIsNotRunning:
      pass
    else:
      if zkfc:
        zkfc.stop(env)
コード例 #2
0
ファイル: utils.py プロジェクト: tsingfu/bigdata
def safe_zkfc_op(action, env):
    """
  Idempotent operation on the zkfc process to either start or stop it.
  :param action: start or stop
  :param env: environment
  """
    Logger.info("Performing action {0} on zkfc.".format(action))
    zkfc = None
    zkfc_slave = ZkfcSlave()
    if action == "start":
        try:
            zkfc_slave.status(env)
        except ComponentIsNotRunning:
            zkfc_slave.start(env)

    if action == "stop":
        try:
            zkfc_slave.status(env)
        except ComponentIsNotRunning:
            pass
        else:
            zkfc_slave.stop(env)
コード例 #3
0
ファイル: utils.py プロジェクト: gbasehd/GBase-Ambari
def safe_zkfc_op(action, env):
    """
  Idempotent operation on the zkfc process to either start or stop it.
  :param action: start or stop
  :param env: environment
  """
    zkfc = None
    if action == "start":
        try:
            zkfc = ZkfcSlave()
            zkfc.status(env)
        except ComponentIsNotRunning:
            if zkfc:
                zkfc.start(env)

    if action == "stop":
        try:
            zkfc = ZkfcSlave()
            zkfc.status(env)
        except ComponentIsNotRunning:
            pass
        else:
            if zkfc:
                zkfc.stop(env)